album.php-part of code without connection function - <form action="submit.php" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="return requiredCheck(this);">
-
<table><td>
-
<tr><input name="file" type="file" id="file"
-
class="txt_blacknormal" size="40" /></tr>
-
</td>
-
<td><tr> <input name="Submit" type="submit" value="Submit" /></tr></td></table>
-
<form>
-
submit.php -
<?php
-
include "session.php";
-
include "function.php";
-
$adminalbum = new Adminalbum;
-
-
if (@$_POST['Submit'] == "Submit")
-
{
-
$cname =$_POST['cname'];
-
$cdesc=$_POST['cdesc'];
-
$file1=$_POST['file'];
-
-
$info =$cname;
-
$id2 = session_id();
-
$ip_address = "$_SERVER[REMOTE_ADDR]";
-
session_register("info");
-
if (!$admincate->checkCate($cname))
-
{
-
header("Location: albumnew.php?m=ext");
-
}
-
else{
-
-
$cid = $admincate->getNewID('c','cid','category');
-
if ($admincate->addCate($cid,$cname,$cdesc,$file,$file_name))
-
{
-
session_unregister("info");
-
-
header("Location: albumreview.php?cid=$cid");
-
-
}
-
else
-
{
-
echo "<SCRIPT>alert(\"Database Error! Unable to add data into database!\");history.go(-1)</SCRIPT>";
-
}
-
}
-
-
}
-
?>
-
function.php -
<?
-
include "admin_connectDB.php";
-
class adminalbum{
-
function addCate($cid,$cname,$cdesc,$file,$file_name)
-
{
-
if($file!='' && $file!='none')
-
{
-
$path = "../albumpic/$file_name";
-
$query = "SELECT cpic FROM category WHERE cpic = '$path'";
-
$result = mysql_query($query);
-
if(mysql_num_rows($result)!=0)
-
{
-
$file_path = $this->generate_num('albumpic',$file_name,'cpic','category');
-
$path = "../albumpic/$file_path";
-
}
-
copy($file, $path);
-
-
}
-
else
-
{
-
$path = "";
-
}
-
$query1 = "INSERT INTO category VALUES('','$cid','$cname','$cdesc','$path','','','')";
-
$result1 = mysql_query($query1);
-
if ($result1)
-
return true;
-
else
-
return false;
-
}
-
}
-
?>
-
1 1571
All of the datas can insert into database but just the uploaded picture data was failure to insert.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: matt |
last post by:
I have compiled some code, some written by me, some compiled from
various sources online, and basically i've got a very simple flat file
photo gallery. An upload form, to upload the photos and give...
|
by: Michael Jaeger |
last post by:
Dear ciwah,
I'm in the process of designing a German school web site, and I need the
help of you experts.
I wrote the navigation (CSS based, no javascript), which looks OK in IE,
Firefox and...
|
by: Ig |
last post by:
Hi, I have an embedded picture with caption on tab page and want to make it
appear and disappear
when certain conditions happen.
To make it disappear I just code it like : Me!MyTab.Picture = ""....
|
by: Max |
last post by:
How do I declare in the parent page's code behind a user control? I want to
call a sub that is located in the user control.
Want to do something like this:
Call MyUserControl.MySub()
|
by: Brian Lowe |
last post by:
My web site accepts uploaded photos and stores them in a SQL table as BLObs
so they never touch the filesystem.
I have a way to create a thumbnail version of the uploaded image and store
that in...
|
by: -Karl |
last post by:
Apparently, asp.net has a posting issue with refreshing. There seems
to be several solutions to the issue but I was wondering if there is a
final workaround for the issue?
If so, can you please...
|
by: J-T |
last post by:
Hi All,
There is a picture on the following URL which I want to have it in one of
my asp.net pages .I mean I want to embed the content of this page in my own
page and get its image.Is there a...
|
by: jhcorey |
last post by:
This is an ASP.NET 2.0 question.
In 1.0, common techniques for communicating between a page and the
controls on it
depended on being able to declare variables of the page and control
types....
|
by: Rasmus Teglgaard |
last post by:
Hi
I'm trying to get a picture uploaded to the picture attribute in Active Directory. I've got most of it working, the only thing I need now, is to convert this picture to a byte array, so that I...
|
by: oranoos3000 |
last post by:
hi
i'm a beginer javascript
would you please help me
i d like to findout this page has next page or previous page in history object
i use this line of code
if(window.history.length>0)
and with...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |