close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Problems Uploading Large Image Files

Thread began 5/02/2012 12:13 pm by joshuadunaway434873 | Last modified 5/02/2012 2:27 pm by Josh Dunaway | 878 views | 4 replies |

joshuadunaway434873

Problems Uploading Large Image Files

Up front I want to say that my both POST and Upload File Sizes are set to 32M in my PHP.ini file.

That being said, I can upload images roughly 2mb or less with no problem. The temporary file is created and then renamed to the original file name on the server, and everything is great.

Once I try to upload anything larger, it succeeds in uploading it, but it creates a temp file like "5d379b1cdb540ae2f4707f6396add8c7_tmp.JPG" and instead of renaming the file to it's original filename, it just removes the _tmp suffix and that results in the image being named "5d379b1cdb540ae2f4707f6396add8c7.JPG". The image then doesn't show up on the site because the filename that's added to the database is the original filename and therefore doesn't match the name on the server.

This ONLY happens with the large files. And I'm actually trying to resize them to 300px wide with the uploader. Here's my sample code for the uploader:

<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../files/staff/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "300",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(((isset($_POST["addStaff"]))?$_POST["addStaff"]:"")){
WA_DFP_UploadFiles("WA_UploadResult1", "photo_staff", "2", "[NewFileName]_[Increment]", "JPG:100", $WA_UploadResult1_Params);
}
?>

Thanks in advance!

Sign in to reply to this post

Jason ByrnesWebAssist

this is a problem with the memory limit on the server. resizing the images takes quite a bit of memory from the server to accomplish.

Most likely, if you turned on error reporting, you would see an error about the server memory limit being exceeded.

you may be able to increase the memory available to PHP scripts by adding the following code at line 1:

php:
<?php

ini_set
("memory_limit""256M")
?>




however, the host may have this setting locked down so it cannot be changed.

Sign in to reply to this post

Josh Dunaway

You sir, are awesome! Thank you so much for your help and for the super-fast response!

Sign in to reply to this post

toms016390756

How did you fix it





Sign in to reply to this post

Josh Dunaway

I just updated the server's maximum memory limit like Jason mentioned above. I was able to get by with adjusting the it to 64M (it was originally at 32M). It works beautifully now, even on an image that was 5.6MB. It now uploads and automatically resizes the image down to 300px and maintains the correct filename.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...