|
-
Aug 5th, 2007, 05:12 PM
#1
Thread Starter
WiggleWiggle
Upload Script - Wont Upload Big Files
I recently edited my image upload script because it was poorly written the first time, and now it wont upload files larger then a thumb nail. I am not getting any errors or anything. I changed my error_reporting to E_ALL | E_STRICT and only get undefined variable warning.
i have 200+ lines of code in this script, so here is just the main upload part:
PHP Code:
switch($newalbumstat) {
case "true":
#IS A NEW ALBUM, GET ALBUM ID, INSERT INTO DB, THEN UPLOAD
$sql = "SELECT `album_id` FROM `picture_albums` WHERE `name`='$newalbum' AND member_id='$memid' LIMIT 1";
$query = mysql_query($sql);
$a = mysql_fetch_array($query);
$albumid = $a['album_id'];
#ADD IMAGE TO DATABASE
$fullurl = "http://pics.rapidfriends.com/$memid/$newpicname";
$uploadurl = "pics/$memid/$newpicname";
$caption = $_POST['caption'];
$sql = "INSERT INTO `pictures` SET member_id='$memid', caption='$caption', url='$fullurl', album='$albumid'";
$query = mysql_query($sql);
$result = move_uploaded_file($_FILES["image"]["tmp_name"], $uploadurl);
func_makethumb_avatar_upload($uploadurl,400,$ext);
$res=chmod($uploadurl,0755);
break;
case "false":
#NOT A NEW AlBUM
//$albumid = $_POST['album'];
$fullurl = "http://pics.rapidfriends.com/$memid/$newpicname";
$uploadurl = "pics/$memid/$newpicname";
$caption = $_POST['caption'];
$sql = "INSERT INTO `pictures` SET member_id='$memid', caption='$caption', url='$fullurl', album='$albumid', location='$uploadurl'";
$query = mysql_query($sql);
$result = move_uploaded_file($_FILES["image"]["tmp_name"], $uploadurl);
func_makethumb_avatar_upload($uploadurl,400,$ext);
$res=chmod($uploadurl,0755);
break;
}
My usual boring signature: Something
-
Aug 13th, 2007, 12:44 PM
#2
Re: Upload Script - Wont Upload Big Files
It's possible that if uploading a large file takes too long, your script or the web server is hitting a timeout. The default max execution time on php is 30 seconds, so if it's failing quicker than that you can ignore the max_execution_time directive.
You'll also need to check what your timeout is set to on your webserver; apache and IIS both default to 300 seconds according to the PHP page.
Hope this helps.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Aug 15th, 2007, 03:42 AM
#3
Re: Upload Script - Wont Upload Big Files
Maximum execution time exceeded will produce a fatal error. Have you checked the error code for the uploaded file $_FILES['filename']['error'].
You also need to check the upload_max_filesize directive in php.ini. If your upload size is bigger than this, it will fail.
And WHEN are you going to learn to escape variables that go into sql?
-
Aug 15th, 2007, 12:32 PM
#4
Thread Starter
WiggleWiggle
Re: Upload Script - Wont Upload Big Files
escape meaning using / / ?
field=/"test"/?
My usual boring signature: Something
-
Aug 16th, 2007, 02:10 AM
#5
Re: Upload Script - Wont Upload Big Files
No, a backslash. mysql_escape_string()
-
Aug 16th, 2007, 03:37 AM
#6
Re: Upload Script - Wont Upload Big Files
I told you it would be easier to use MySQLi or PDO.
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
|