Can you check your error log to see if there is any
PHP error occurring.
Also a few hints
It is is much more secure to use is_uploaded_file() and move_uploaded_file() in
PHP.
So you could change your code to be
- PHP: Select all
<?php
//receiving uploaded file from client side
echo $_POST['uname']. " Hello:<p>";
$error_msg=$_FILES['ufile']['error'];
$fname=$_FILES['ufile']['name'];
$tmpname=$_FILES[['ufile']['tmp_name'];
$fsize=$_FILES['ufile']['size'];
$ftype=$_FILES['ufile']['type'];
//if to determining file be successfully uploaded
// Is uploaded file makes sure that the file was uploaded and not a user trying to use HTTP tricks to work with files it shouldn't
if(!is_uploaded_file($fname)){
echo "<font color='red'> File has not been uploaded successfully!</font><p>";
if ($error_msg)
echo "The relevanted error is: ".$error_msg;
}else{
//file uploaded successfully
echo "Already received uploaded file, file name is: ".$fname."<br>";
echo "File name is the server position as temp is: ".$tmpname."<br>";
echo "Uploaded file size is: ".$fsize."<br>";
echo "Uploaded file type is: ".$ftype."<br>";
echo "<hr>";
//save the uploaded file to the respective folder
$success=move_uploaded_file($tmpname,'newtext.txt');
if($success){
echo "File has been copied successfully<br>";
echo "New file path and directory name is below: <br>";
echo realpath('newtext.txt')."<p>";
//delete this uploaded file
unlink($tmpname);
}else{
echo "<font color='red'>Can not copy this file !</font>";
}
}
I can't see what would be causing no output (as script looks okay) unless it's a fatal error.
Hope that helps some.