By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

Ubuntu7.10+Apache2+PHP5 Files not uploading...

P: 2
Ok...
I've been trying to track this down between two "similar" systems (one that appears to work and the other that doesn't)... and I'm decided to ask for help.

I have an Ubuntu 7.10 based system, with Apache2 + PHP5 installed, but when I attempt to implement even a SIMPLE file upload script, the files are not getting stored into the "/tmp" directory. I have validated that my maximum upload & post sizes are 10M... and I'm attempting to upload either a simple text file (helloworld.txt) or a small 30kb jpeg and neither are placed into the /tmp directory. The filename for the /tmp directory is displayed from the upload_file.php script to the screen, but that file doesn't exist.

Here is an example of the scripts:
(upload.html)
<html>
<body>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

--------------------------------------
(upload_file.php)
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
------------------------------

Any ideas?
Thanks,
Clintec.
Mar 24 '08 #1
Share this Question
Share on Google+
2 Replies


P: 2
Here is the output I get from attempting to post a small JPEG file.

Upload: gdg.jpg
Type: image/jpeg
Size: 14.5869140625 Kb
Stored in: /tmp/phpJCyUQl


And unfortunately the file (/tmp/phpJCyUQl) doesn't exist.

Any help would be appreciated.
Mar 24 '08 #2

P: 82
/tmp/phpJCyUQl is a temporary name for uploaded file. You have to copy() it to other place.
Read this:
http://php.net/manual/en/features.file-upload.php
Mar 24 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.