Jump to content

[SOLVED] Upload Script Problems


All4172

Recommended Posts

I'm working with a simple upload script where users can upload pic files and the rest.  The pics are of professional variety so they can be quite large (20MB -60MB).  When I run a test file that is around 3-5 MB's it'll upload fine.  However, when I began to attempt to upload files that are 15-20+ MB's it seems to do nothing.  I'm guessing the server is timing out?  Is there anything I can add to the below script so a server doesn't time out?

 

<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']);

$ok=1;

$uploaded_size = $_FILES['uploaded']['size']);
if ($uploaded_size > 70000000)
{
echo "Your file is too large. Max file size is 70MB and your file was $uploaded_size<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "Target Path - ";
echo $target;
echo "<BR>File Size - ";
echo $uploaded_size;
echo "<BR>File Name - ";
echo basename( $_FILES['uploaded']['name']);

}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/49484-solved-upload-script-problems/
Share on other sites

only options are

 

#1 edit the php.ini file, add

post_max_size = 8000000
upload_max_filesize = 8000000

 

#2 try adding this to your script

ini_set('post_max_size', '8M');
ini_set('upload_max_filesize', '8M');

 

#3 try adding this to your .htaccess file:

php_value post_max_size 8M
php_value upload_max_filesize 8M

 

 

**note edit these sizes (i used 8Mb for the examples)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.