FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

PHP uploads

 


kingy2k6
I have created a simple PHP script and HTLM form to allow users to upload photos. However, $_FILES['tmp_name'] is always empty. Why is this? Are php uploads allowed?
afracsass
do you mean frih.net? Yes, php upload is allowed.
please post how you created form and php upload script.

I posted a simple form and php script to upload a file.
compare yours with the code below


Form:
Code:

<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>


php:
Code:

<?php

// Where the file is going to be placed
$target_path = "./";
$ufilename = $_FILES['uploadedfile']['name'];

$uploadfile = $target_path.$ufilename;

if($ufilename != ""){
print "<pre>";
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadfile)) {
   print "Upload success notice goes here.\n";
   print_r($_FILES);
} else {
   print "Upload fail notice goes here.\n";
   print_r($_FILES);
}
print "</pre>";
}
?>



good luck!
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.