IT Community - Software Programming, Web Development and Technical Support

"POST" large amount of data using SendAndLoad (Exporting JPG/JPEG)

This is a discussion on "POST" large amount of data using SendAndLoad (Exporting JPG/JPEG) within the Flash Actionscript Programming forums, part of the Web Development category; I'm looking to "POST" a large amount of data (image) to a PHP file (obviously to create ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Flash Actionscript Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-07-2007, 08:28 AM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 72
aramesh is on a distinguished road
Default "POST" large amount of data using SendAndLoad (Exporting JPG/JPEG)

I'm looking to "POST" a large amount of data (image) to a PHP file (obviously to create an exported image), but when using SendAndLoad, accompanied with a setInterval to check if there is a response, if the image is too large I get a timeout.

This works fine if I use a small image (200x200), but anything bigger and I get a timeout error, OR if the user has a slow connection, again, timeout error.

Is there a way to increase this timeout so that flash will wait longer for a response from the server? I'm also using an RLE (run length encoding) that I wrote to capture white space to save on space, but again, same problem if the image is too large.

Current Code I'm using:

function sendData()
{ //note: there is another function that gets all the pixels of the MC
// but is not needed
var output:LoadVars = new LoadVars();
// set the output of "img" to the captured pixels
output.img = pixels.toString();
output.height = h;
output.width = w;
// send the output
output.sendAndLoad("http://www.mysite.com/show.php", result_lv, "POST");

checkResultIntervalID = _global.setInterval( this, "checkResult", 5000 );

}

function checkResult()
{
// wait for server response
if (result_lv.toString() == "")
{
imgtag.text = "Waiting for Server...";
}
// trace the result from php and clear the check
else
{
trace(result_lv.toString());
clearInterval(checkResultIntervalID);
}
}

Last edited by aramesh : 11-15-2007 at 09:27 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-10-2007, 02:14 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Smile Re: "POST" large amount of data using SendAndLoad (Exporting JPG/JPEG)

The PHP presents a very versatile and user friendly interface for handling file uploads, the default installation is not geared for working with files in excess of 2 Mega Bytes. This post help you configure your PHP engine for handling such large file transfers.

You can call the phpinfo() function to find the location of your php.ini file, it will also tell you the current values for the following settings that we need to modify

file_uploads
upload_max_filesize
max_input_time
memory_limit
max_execution_time
post_max_size

The first one is fairly obvious if you set this off, uploading is disabled for your installation.

According to the PHP documentation you can set a MAX_UPLOAD_LIMIT in your HTML form to suggest a limit to the browser.

memory_limit
When the PHP engine is handling an incoming POST it needs to keep some of the incoming data in memory. This directive has any effect only if you have used the --enable-memory-limit option at configuration time. Setting too high a value can be very dangerous because if several uploads are being handled concurrently all available memory will be used up and other unrelated scripts that consume a lot of memory might effect the whole server as well.

max_execution_time and max_input_time
These settings define the maximum life time of the script and the time that the script should spend in accepting input. If several mega bytes of data are being transfered max_input_time should be reasonably high. You can override the setting in the ini file for max_input_time by calling the set_time_limit() function in your scripts.

I think by setting the above said variables in php config file can help you to upload large files.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-28-2007, 02:42 AM
seesamjagan seesamjagan is offline
D-Web Programmer
 
Join Date: Aug 2007
Location: Chennai
Posts: 66
seesamjagan is on a distinguished road
Send a message via AIM to seesamjagan Send a message via Yahoo to seesamjagan
Post Re: "POST" large amount of data using SendAndLoad (Exporting JPG/JPEG)

hi
one suggestion to monitor the progress & result of the uploading


don't use interval concept, better use event listener for your LoadVars

use onProgress event to show a progress bar while it uploads the data
use onComplete event to continue further after the success full upload.
__________________
SeeSamJagan
- Sky is not the "LIMIT", Death is not the END, There is still something beyond....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between "using System.Data;" and directly adding the refer KiruthikaSambandam ASP and ASP.NET Programming 1 11-15-2007 01:33 AM
I keep getting "Data Missing" when I click the "back" button in my browser. How can I oxygen HTML, CSS and Javascript Coding Techniques 1 07-28-2007 01:12 AM
What is the difference between "using System.Data;" and directly adding the reference H2o ASP and ASP.NET Programming 1 07-24-2007 03:33 AM
Why do I get "HTTP 500" error(or "(DLL)initialization routine failed")in my browser? kingmaker ASP and ASP.NET Programming 1 07-20-2007 04:38 AM
Difference between a "assignment operator" and a "copy constructor"? vigneshgets C and C++ Programming 2 07-12-2007 05:30 AM


All times are GMT -7. The time now is 06:02 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0