File upload to different location in the same server failed
Moderator: General Moderators
File upload to different location in the same server failed
Hi,
I have a problem with file upload.
My source code is located at 'var/www/html/'. After successful file upload the files should be placed at '/opt/red5/streams/', which is also located in the same server.
But i am not able to upload the file, my requirement is to upload FLV files. I tried with move_uploaded_file() and copy() functions not only for FLV files but also for other file extenstions. But it didn't worked out for me.
Could anyone tell me what would be the solution to fix this issue?
I have a problem with file upload.
My source code is located at 'var/www/html/'. After successful file upload the files should be placed at '/opt/red5/streams/', which is also located in the same server.
But i am not able to upload the file, my requirement is to upload FLV files. I tried with move_uploaded_file() and copy() functions not only for FLV files but also for other file extenstions. But it didn't worked out for me.
Could anyone tell me what would be the solution to fix this issue?
Re: File upload to different location in the same server failed
Code?
Have you got error reporting turned on?
Have you got error reporting turned on?
Re: File upload to different location in the same server failed
Thanks for your response. It's the normal PHP file upload code. I didn't tried with error_reporting(E_ALL); Let me try it & come back.jackpf wrote:Code?
Have you got error reporting turned on?
Re: File upload to different location in the same server failed
What?It's the normal PHP file upload code
Re: File upload to different location in the same server failed
Here is the source code which we are using:
Upload processing code:
Please help me.
Upload processing code:
Code: Select all
<?php
$video_path = '/opt/red5/streams/';
if($_POST['submit'] == 'Send File')
{
$imag_name =$_FILES['uploadedfile']['name'];
$storage = $video_path;
$uploadfile = "$storage" .$imag_name;
try {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadfile))
{
$insert_video = mysql_query("insert into videos(name) values('".$imag_name."')");
chmod($uploadfile, 0777);
echo $imag_name; exit;
}
else
{
echo "Video not uploaded";
}
}
catch(Exception $e) {
print_r($e);
}
}
?>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="uploadedfile" type="file" />
<input type="submit" name="submit" value="Send File" />
</form>
Re: File upload to different location in the same server failed
Thanks for your reply. This is what I got,
Code: Select all
Array ( [uploadedfile] => Array (
[name] => fish.flv
[type] => video/x-flv
[tmp_name] => /tmp/phpRuK1O8
[error] => 0
[size] => 241311 ) )
Re: File upload to different location in the same server failed
Hmm...well there's no upload error...
Try puttingat the top of the script.
If it's a permissions error, you should get an error message about it.
Try putting
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', E_ALL);If it's a permissions error, you should get an error message about it.