|
-
October 27th, 2005, 11:44 AM
#1
Help for file uploading
Hello to everybody!
I've written a short PHP script for menaging the file uploading. the problem is that it doesn't upload every kind of file but only some (for ex. .txt and .doc). If someone can tell me why. i'd be grateful. Thanks and byez
Follows the code:
$uploaddir="C:/apache2triad/htdocs/tu4tu/Uploads/"; //Set the upload directory in the server machine
if((isset($_POST['action'])) && ($_POST['action'] == 'Alttach')) {
$uploadfile=$uploaddir.$_FILES['userfile']['name'];
echo $_FILES['userfile']['tmp_name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<br>".basename($uploadfile);
?>
<table>
<tr>
<td>File uploaded!</td>
</tr>
</table>
<?php } else {
?>
<table>
<tr>
<td>File not uploaded!</td>
</tr>
</table>
<?php
}
}
?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
<input type="file" name="userfile">
<input type="submit" name="action" value="Attach">
</form>
-
October 27th, 2005, 12:33 PM
#2
Re: Help for file uploading
If it is only uploading certain file types, the problem is most likely the server restrictions. Check your server settings to see what MIME types it handles.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 1st, 2005, 07:28 AM
#3
Re: Help for file uploading
Problem solved!!
As you said it was a configuration problem.
I left the POST_UPLOAD_SIZE set at 2 MB (retard)!
Thank you wery much!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|