Jump to content

Query not executed until upload.


rondog

Recommended Posts

I am calling this PHP script through flash. What I am doing is selecting a big list of FLV files to upload, pretty simple.

 

I was wondering why my query doesn't get called until after the upload occurs. I watch the file upload through filezilla and once it is done uploading, then my query gets called. This is the asynchronous vs synchronous I am assuming. If I remember correctly, their is a setting in the php ini file that will change how long the script will go before it times out. Should I increase that since all my code isnt getting called until it uploads? Thanks guys.

$format			= strtolower(str_replace(" ", "_", basename($_FILES['Filedata']['name'])));
$filename			= $format;
$file 				= $_FILES["Filedata"]["tmp_name"];

$ftp_server 		= "ftp.myserver.com";
$ftp_user_name 	= "myusername";
$ftp_user_pass 	= "mypassword";
$destination_file 	= "/u/clients/army/search/temp/" . $filename;
$source_file 		= $file;
$source			= "rtmp://myserver.fcod.llnwd.net/a3870/o35" . $destination_file;

// set up the FTP connection
$conn_id 			= ftp_connect($ftp_server);
$login_result 		= ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);


// upload the file
$upload 			= ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

// check upload status
$sql	= "INSERT INTO am_assets (shoot_path, type, title, location, date_shot, tags, rights, description, source) VALUES ('$path','$type','$title','$location','$date','$tags','$rights','$description','$source')";

$query 	= mysql_query($sql) or die(mysql_error());
if ($query)
{
echo "success";
}
// close the FTP stream
ftp_close($conn_id);

Link to comment
https://forums.phpfreaks.com/topic/201282-query-not-executed-until-upload/
Share on other sites

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.