Create a folder in Web space. Browse the images using <input type="file" name="photo"> Post to another page.
if ($HTTP_POST_FILES['photo1']['name'] != "")
{
$Pict1=$Email.'_'.$random.'_1.jpg';
copy($HTTP_POST_FILES['photo1']['tmp_name'],"Image_upload_Folder/".$Pict1);
}
I upload the images using this technique. Try this.
Create a folder in Web space. Browse the images using <input type="file" name="photo"> Post to another page.
if ($HTTP_POST_FILES['photo1']['name'] != "")
{
$Pict1=$Email.'_'.$random.'_1.jpg';
copy($HTTP_POST_FILES['photo1']['tmp_name'],"Image_upload_Folder/".$Pict1);
}
I upload the images using this technique. Try this.
Use of $HTTP_POST_FILES is deprated and also disable on many servers with modern PHP builds.
I have tested script and have the following question:
The requested URL ...upload.processor.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Do you know what can be wrong? Need help.
I have created directory on web site: uploaded_files
and code for path is:
$uploadForm = 'http://www.my domain/' . $_SERVER['HTTP_HOST'] . $directory_self . 'upload.form.php';
I have put:
// make a note of the location of the upload form in case we need it
$uploadForm = 'http://' . $_SERVER['mydomain.com'] . $directory_self . 'upload.form.php';
It gives me error:
Not Found
The requested URL /www.mydomain.com/upload.processor.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
// make a note of the location of the upload form in case we need it
$uploadForm = 'http://www.my domain/' . $_SERVER['HTTP_HOST'] . $directory_self . 'upload.form.php';
LCF is right. That won't work. All you needed to do was download the zip and then upload it all to your server maintaining the directory structure in the zip file and it will work with any modifications.
Thanks Bokeh,
it works. I have just two questions:
1. I have given permission 777 (highest) and also first 0644
but there is error:
An error has occured: receiving directory insuffiecient permission... The upload form is reloading
2. It was error that file is too large.
I have changed to $max_file_size = 5000000; // size in bytes but it gives me error even file is 54 kB
switch ($mode){
case "Add":
//-- RE-SIZING UPLOADED IMAGE
/*== only resize if the image is larger than 600 x 600 ==*/
$imgsize = GetImageSize($listingimage);
/*== check size 0=width, 1=height ==*/
if (($imgsize[0] > 600) || ($imgsize[1] > 600))
{
/*== if an error occurs the file could not
be written, read or possibly does not exist ==*/
print "Your File is to large. Maximum file dimensions are 600px x 600px.";
exit();
}
$max_filesize_k = ($max_filesize / 500);
if($_FILES['$listingimage']['size'][$i] > $max_filesize)
{
echo "Your file is too large. Files may be up to ".$max_filesize_k."K\n";
include("listingentry.php");
exit;
}
if($HTTP_POST_FILES['txtlistingimage']['name'] == ""){
$listing_image = "";
}else{
$listing_image = getfilename($HTTP_POST_FILES['txtlistingimage']['name'],1);
copy ( $HTTP_POST_FILES['txtlistingimage']['tmp_name'],$dirupload.$listing_image)
or $msgid=2;
}
$strInsert="Insert into listing_master(city_id,category_id,listing_title,listing_location,listing_price,listing_text,listing_address,listing_city,listing_image,listing_email,listing_email_option,listing_contact_information,listing_date,listing_show,listing_buysell,listing_premier) values (";
if($listing_date == ""){
$strInsert=$strInsert . "$city,$c_id,'$listing_title','$listing_location',$listing_price,'$listing_text','$listing_address','$listing_city','$listing_image','$listing_email','$listing_emailoption','$listing_contactinfo',NULL,'$listing_show','$listing_buysell','$listing_premier')";
}else{
$strInsert=$strInsert . "$city,$c_id,'$listing_title','$listing_location',$listing_price,'$listing_text','$listing_address','$listing_city','$listing_image','$listing_email','$listing_emailoption','$listing_contactinfo','$listing_date','$listing_show','$listing_buysell','$listing_premier')";
}
$MsgId=1;
if(!($dbResult = mysql_query($strInsert, $dbLink)))
{
$success = "false";
$MsgId=2;
}
// $ssql = "SELECT max(listing_id) as listing_id FROM listing_master";
How can I get the images to be viewable after they are uploaded. Is this something that has to be done manually or is there a scipt I can place into a page to make the images viewable?
Thanks in advance.
Har
Harry Kerstetter
President
Tylivia Web Design Browser: Firefox 2 beta 2 Resolution: 1440 X 900 Development Tools:
Macromedia/Adobe Studio 8
Adobe Illustrator CS
SWiSH Max
PHP Designer 2005 Favorite Quote:"In completing one discovery we never fail to get an imperfect knowledge of others of which we could have no idea before, so that we cannot solve one doubt without creating several new ones." - Joseph Priestly, 1786
Bookmarks