...

View Full Version : Upload Script Help



ASTP001
09-03-2011, 01:56 AM
Hi, I'm trying to make an upload page so that a user can upload files into an archive folder for this organization... and I've run into a couple of problems...

1) When I try to upload a big enough file, I get
"Error 103 (net::ERR_CONNECTION_ABORTED): Unknown error."

2)When it does actually go through I get this error:
"The requested resource
/upload.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit."

so, I googled this problem and people suggested to add things to .htaccess file, and I did... here is what I put down:

php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 800
php_value max_input_time 800

and that didn't help solve the problem. What should I do?

ASTP001
09-03-2011, 08:44 AM
Here is the code if that helps:

$target_path = "Archives/".$_POST['view']."/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
else if(!isset($_FILES['uploadfile']))
{
echo'<center><table><form enctype="multipart/form-data" action="upload.php" method="POST">
<tr align=left><td>Upload to
<select name=view>
<option value=E-Board>Admin</option>
<option value=Public>Public</option>
</select> Section.</td></tr>
<tr align=left><td>Choose file: <input name="uploadedfile" type="file" /></td></tr>
<tr align=left><td><input type="submit" value="Upload File" /></td></tr></table></center>
</form>
';
}
else{
echo "There was an error uploading the file, please try again!";
}

sim_pack
09-03-2011, 01:50 PM
Here is the code if that helps:

$target_path = "Archives/".$_POST['view']."/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
}
echo "There was an error uploading the file, please try again!";
}

i'm curious with the error that you are getting. i also use nearly the same sequence of codes for my uploads and i don't get any errors since i've used them. what's slightly different with our codes is with the way the target path is constructed. i use absolute path for my target folder utilizing '$_SERVER['DOCUMENT_ROOT']' and then appending my target folder for saving the files. if you're using relative path for your $target_path, shouldn't there be a '.' or a '..' before the 'Archive' folder?

ASTP001
09-03-2011, 07:49 PM
i'm curious with the error that you are getting. i also use nearly the same sequence of codes for my uploads and i don't get any errors since i've used them. what's slightly different with our codes is with the way the target path is constructed. i use absolute path for my target folder utilizing '$_SERVER['DOCUMENT_ROOT']' and then appending my target folder for saving the files. if you're using relative path for your $target_path, shouldn't there be a '.' or a '..' before the 'Archive' folder?

The Archive folder is in the root folder, so I think I don't have to do it. When I upload small files, it goes to the correct location.

developerx
09-05-2011, 05:55 PM
Hi, did you solve the problem? I have the same issue and I can't find an answer.
Thanks.

ASTP001
09-05-2011, 07:34 PM
Well, I didn't solve the problem exactly. What I did is tried to use the code set_time_limit() and my webpage gave me an error saying that the function was disabled for security reasons. So, my host just doesn't allow me to temper with these things is the conclusion that I got to. I either need to upgrade to a premium host, or find a better way around this. If anyone has any ideas, that would be much appreciated.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum