usapphire Posted February 22, 2007 Share Posted February 22, 2007 Hi again - just like to say thank you for previous help. Just a quick one today, I'm quite sure it's just me doing something completely wrong. After uploading my previous upload/download script and getting it to work (refer to my other topics; Upload & Download Script and Error in uploading file), it ended up not working completely right. I had someone try to upload a 10 mb file, and it came with an error.. I realized this must have something to do with the max upload allowed, and so, in my .htaccess file, I set it to; php_value upload_max_filesize 1000M Just to see if it'll work. Still no luck. After trying to upload a 10 mb file, I think it "times out" within 3-4 minutes. It refreshes the page, where it's suppose to display the "FILE HAS BEEN UPLOADED SUCCESSFULLY", but displays nothing - nor is the file uploaded to the directory, listed on the download list, or even added to the MySQL. Does anyone know what might be the problem? Thank you (I can post the site for those who want to try it out, but it contains 16+ content (it's an upload site for aarinfantasy.com). Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/ Share on other sites More sharing options...
ess14 Posted February 22, 2007 Share Posted February 22, 2007 are you hosting the servers?! if not... youd wanna get onto them about it. Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-190923 Share on other sites More sharing options...
usapphire Posted February 22, 2007 Author Share Posted February 22, 2007 It's a reseller hosting where I can make shared accounts.. Does this count? Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-190943 Share on other sites More sharing options...
usapphire Posted February 22, 2007 Author Share Posted February 22, 2007 Hi.. still need help with this I emailed the original host seller, but they haven't replied.. maybe they don't know what's going on / what I mean.. Can anyone help? :'( Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-191448 Share on other sites More sharing options...
usapphire Posted February 23, 2007 Author Share Posted February 23, 2007 No one? :'( Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-191881 Share on other sites More sharing options...
pacognovellino Posted February 23, 2007 Share Posted February 23, 2007 Hi, here is a script that I have used <?php $uploadDir = 'C:/AppServ/www/paco/img/'; /* $dir cambia el nombre del directorio a img/ */ $dir = 'img/'; if(isset($_POST['TESY'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $filePath = $dir . $fileName; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error subiendo archivo"; exit; } include 'includes/config.php'; include 'includes/open.php'; if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO upload (name, size, type, path, fecha, comentario, noticia) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$fecha', '$comentario', '$noticia' )"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); include 'includes/close.php'; echo "<br>Archivo cargado<br>"; } ?> You just need to create a table call upload, and for the $uploadDir, I was having some troubles untill I figure that you have to put all the address from your server /home/interpas/ and so on, it may vary from server to server oh and remember to make your folder 777 hope it works cheers Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-191921 Share on other sites More sharing options...
usapphire Posted February 23, 2007 Author Share Posted February 23, 2007 Hi.. my upload script works fine - the only thing is that it times out for no reason; it happens in this script too. Uploading files like ~5mb works perfectly, but going for files more than 10mb times out.. Thanks for helping, but this didn't fix it Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-192122 Share on other sites More sharing options...
mbtaylor Posted February 23, 2007 Share Posted February 23, 2007 Theres a few things you need mate: 1. max post setting 2. max file upload setting 3. max script execution time 4. Apache Limitrequestbody is not too low I have also personally experienced an issue with my IPTABLES script which was preventing large uploads... I had to add: # allow all fragments -A INPUT -f -j ACCEPT # allow icmp traffic -A INPUT -p icmp -j ACCEPT This is explained in the php manual file uploads page. Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-192126 Share on other sites More sharing options...
usapphire Posted February 23, 2007 Author Share Posted February 23, 2007 Theres a few things you need mate: 1. max post setting 2. max file upload setting 3. max script execution time 4. Apache Limitrequestbody is not too low I have also personally experienced an issue with my IPTABLES script which was preventing large uploads... I had to add: # allow all fragments -A INPUT -f -j ACCEPT # allow icmp traffic -A INPUT -p icmp -j ACCEPT This is explained in the php manual file uploads page. Hello, and thank you for the reply! I don't exactly understand where to put this code, and where do I find the codes / tutorials on how to do the 4 points you listed above? If you want, can I post my full upload script here and have it edited to the way it should work? If this is asking too much, can you point me in the right direction (for tutorials, or something similar)? If you can do it for me, I'll repay you by giving you a free webhosting space.. as much as up to 50GB of server space, and whatever bandwidth.. Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-192273 Share on other sites More sharing options...
redarrow Posted February 23, 2007 Share Posted February 23, 2007 If you're having problems uploading large files but small files go through fine, here are some things to try: - In the HTML form, make sure you've set MAX_FILE_SIZE to an acceptable value. - In php.ini, be sure you've set the the upload_max_filesize and post_max_size to be large enough to handle your upload. - In your httpd.conf (if you're using apache), check that the LimitRequestBody directive isn't set too low (it's optional, so it may not be there at all). If those settings don't work, you can check your firewall configuration. When uploading large files, packets have to be split into fragments of varying size depending on your systems MTU (maximum transmission unit), which is typically 1500 bytes. Because some systems send the packets with the headers last (or the header packet may be received after some of the data packets), firewalls can't filter this traffic based on destination port and address. Many firewalls (including iptables) have to be configured to allow fragments separately from standard traffic. Unfortunately, it's an all-or-nothing thing in these cases, and exploits based on packet fragmentation have been a problem in the past (teardrop, boink, etc.). Note that ICMP may be used to notify the host (your server) of oncoming fragmentation, so you may need to allow ICMP traffic as well. The iptables rules for this are as follows: # allow all fragments -A INPUT -f -j ACCEPT # allow icmp traffic -A INPUT -p icmp -j ACCEPT On the bright side, this will also fix some issues with ssh and NFS =) Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-192279 Share on other sites More sharing options...
usapphire Posted February 24, 2007 Author Share Posted February 24, 2007 Hello! Thank you for the very useful reply! There seems to be a problem though.. Where do I locate php.ini? I have a reseller account of a shared hosting, so would that mean I need to contact the server host to change the php.ini? Or should I make a new one in the /etc/ folder? The iptables rules for this are as follows: # allow all fragments -A INPUT -f -j ACCEPT # allow icmp traffic -A INPUT -p icmp -j ACCEPT Where do these go? I'm still new to php, so I don't exactly understand where to put these.. Thank you. Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-192771 Share on other sites More sharing options...
mbtaylor Posted February 26, 2007 Share Posted February 26, 2007 You need to have your host change the php.ini file (if they will) there may be limits for a reason - e.g so users dont use all their resources uploading large files all the time. You will need to get your host to change their IPTables rulesets to implement the iptables bits... Get yourself a dedicated server and learn a bit of linux mate! You have total control then. Link to comment https://forums.phpfreaks.com/topic/39570-php-upload-script-ends-with-unknown-error/#findComment-194225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.