Jump to content

Recommended Posts

I developed a flash app that allows you to select multiple FLV files. I then hit the upload button which calls this php file that connects to my streaming server via ftp:

<?php
include '../../connect.php';
//location vars
$gid				= $_POST['g'];
$sid				= $_POST['s'];
$tid				= $_POST['t'];

//data vars
$title				= $_POST['title'];
$description			= $_POST['description'];
$location			= $_POST['location'];
$rights				= $_POST['rights'];
$keywords			= $_POST['keywords'];


/*********************
* upload file
*********************/
if ($gid)
{
$addTime		= mktime();
$format			= strtolower(str_replace(" ", "_", basename($_FILES['Filedata']['name'])));
$filename		= $addTime.$format;
$file 			= $_FILES["Filedata"]["tmp_name"];

$ftp_server 		= "myserver.net";
$ftp_user_name 		= "myusername";
$ftp_user_pass 		= "mypassword";
$destination_file 	= "/u/clients/army/search/videos/" . $filename;
$source_file 		= $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
if ($upload)
{
	$query = mysql_query("INSERT INTO video (tape_id, filename, name, description, location, rights, keywords) VALUES ('$tid','$filename','$title','$description','$location','$rights','$keywords')") or die(mysql_error());
}
// close the FTP stream
ftp_close($conn_id);
}
else
{
echo "Go away!";
}
?>

 

I developed it on my PC. I am using firefox 3.5.3 and IE8 and the app works fine on my PC...When I go over to my mac, using Safari 4.0.3 or Firefox 3.5.4, it starts to upload the first file, get to 100% and freezes. The upload is successful and the first FLV gets inserted into the DB. It just doesnt continue to upload like it does on my other machine...now that I am writing this, maybe its not a PHP issue at all...maybe its an AS3 issue...who knows.

 

Thoughts?

Link to comment
https://forums.phpfreaks.com/topic/179424-ftp-not-working-on-my-mac/
Share on other sites

Try creating a html form and testing it,

 

Also try really small files in case its a timeout problem

 

The only issue with that would be is an HTML file input field only allows selection of 1 file at a time which is why I created it in flash in the first place. I have hundreds of these +/- 5mb files and I need to select 50+ at one time and then just let them upload on their own. I dont see any errors in my PHP so I am going to start digging into the AS3 code...that might be the problem here, but if anyone see's a problem in the PHP please point it out.

While selecting files individually in HTML is a pain you could create many file inputs as an array (you could also do this in AS3) and then update the PHP code to upload via a loop, this will save the constant opening an closing of the FTP connection,

 

PS i can't see any PHP problems, what about checking apache's error logs

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.