No Images Uploaded!

Sketchee
Sketchee's picture

Joined: 2002-08-28
Posts: 11
Posted: Wed, 2002-08-28 23:16

I'm getting an error "No Images Uploaded!" recently. The FAQ says it is due to php uploads being disabled. So I contacted my host and they say PHP uploads are disabled and always have been. I have used the upload thing many times and this error is recent so I don't know what else it could be! They said there have been no changes to the PHP 4 setup! (The hosts setup is at http://your-site.com/test.php ) PLEASE HELP!

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2002-08-29 05:31

Well, from looking at the php-info it's clear that file uploads are disabled. You can still ftp images to your server and then use the "local filesystem upload" feature, though.

 
Sketchee
Sketchee's picture

Joined: 2002-08-28
Posts: 11
Posted: Thu, 2002-08-29 07:59

Oh yeah. SHould be okay since I'm the only one who ever uploads. So is my host lying to me when they say it's always been disabled considerig that I was able to upload before?

 
Sketchee
Sketchee's picture

Joined: 2002-08-28
Posts: 11
Posted: Sat, 2002-08-31 05:52

Just wanted to update by posting the e-mail they sent me finally admitting and fixing the problems:

Quote:
<pre>
Hello Brian,

Php upload feature has been enabled on our servers. The maximum file size which can be uploaded is set to 2MB.

The files are automatically deleted by PHP, at the end of the session, it is your responsibility to move the file to its permanent location and give it its permanent name. You should always use php function move_uploaded_file() to move the uploaded files.

Example script that allows for a file to be uploaded, then moves it into a directory called "uploads" that should exist in the your www directory. This directory should be chmoded to 777.

save this file as : upload.php
<?php

// Complete working file upload example:

function handleupload() {

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
$realname = $_FILES['userfile']['name'];
print "<br><b>$realname</b> was uploaded successfuly to the temp upload directory";
$size = $_FILES[userfile][size];
print "<br>File size: <b>$size</b> ";
move_uploaded_file($_FILES['userfile']['tmp_name'], "./uploads/".$_FILES['userfile']['name']);
print "<br>Moved File " . $_FILES['userfile']['tmp_name'] . " to " . "./uploads/" .$_FILES['userfile']['name'] . "<br>";
//copy($_FILES['userfile']['tmp_name'],"/opt/local/zeus/site/php_upload_temp".$realname);
} else {
echo "Possible file upload attack: filename".$_FILES['userfile']['name'].".";
}
}

?>

<html><body>

<?php

if ($act == "upload") {
handleupload();
}

?>

<form ENCTYPE="multipart/form-data" method="POST" action="upload.php?act=upload">
File:<INPUT TYPE="FILE" NAME="userfile" SIZE="35">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="submit" value="Upload" name="B1">
Please click only <b>once</b> and wait for confirmation
</form>
<a href=upload.php>clear form</a>
</body>
</html>
</pre>
If you have any questions, feel free to send them.

 
Sketchee
Sketchee's picture

Joined: 2002-08-28
Posts: 11
Posted: Sat, 2002-08-31 05:58

Oh and I have another question regarding the above posted e-mail. Is the way images are moved with gallery as stated above? I've noticed lots of files still in my temp directory. What are they?

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sat, 2002-08-31 09:03

If they all look like 'sess_*' then they are the temporary session files.
They aren't automatically purged, but zeroed out when they expire.
You should use a utility such as 'tmpwatch' to clear it out occasionally
either via a cronjob or running it manually. You can also simply delete them
all once in awhile.