0

HI , CAN ANY ONE TELL ME HOW CAN I UPLOAD A FILE TO MY WEB SERVER WITH OUT USING <INPUT TYPE="FILE"/> , I JUST WANNA USE I BUTTON TO UPLOAD A FILE , AND WHENEVER I CLICKED ON THAT BUTTON I WANNA A FILE WHICH IS ON MY SYSTEM c:/UPLOADFILE/ANY.TXT , SHOULD BE START UPLOADING ..... PLEASE HELP ME

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by diafol
0

you are right Mr ardav ,i have already ftp upload but i wanna that file should be also on webserver , so in this i am getting problem that , if i am uploading form my machine than it woking fine but when same thing i am trying on my webserver , it creating error . i am showing you

// FTP access parameters
$host = 'ftp.mysite.in';
$usr = 'user@mysite.in';
$pwd = 'mysite@123';
 
// file to move:
$local_file = 'd:/3.png';
$ftp_path = '/3.png';
 
// connect to FTP server (port 21)
$conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");
 
// send access parameters
ftp_login($conn_id, $usr, $pwd) or die("Cannot login");
 
// turn on passive mode transfers (some servers need this)
// ftp_pasv ($conn_id, true);
 
// perform file upload
$upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);
 
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";
 
/*
** Chmod the file (just as example)
*/
 
// If you are using PHP4 then you need to use this code:
// (because the "ftp_chmod" command is just available in PHP5+)
if (!function_exists('ftp_chmod')) {
   function ftp_chmod($ftp_stream, $mode, $filename){
        return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));
   }
}
 
// try to chmod the new file to 666 (writeable)
if (ftp_chmod($conn_id, 0644, $ftp_path) !== false) {
    print $ftp_path . " chmoded successfully to 666";
} else {
    print "could not chmod $file";
}
 
// close the FTP stream
ftp_close($conn_id);
0

Moving a file from place to place on the webserver probably needs 'copy()'. or if you want to move a file use 'rename()'. Is that it?

0

i am again telling you :
i wanna do that just one file which is in my computer location "D:/3.png". and wanna upload this file with out using input type file ..... please help me

0

if i am uploading form my machine than it woking fine but when same thing i am trying on my webserver , it creating error

THat suggested to me that upload from machine to webserver was fine, but trying from one area of the webserver to another was not.

Unless you use something like FTP, I can't see how you'd upload a file without input=file as this could be a severe security breach. You'd probably be relying on very low browser security settings. Not advisable.

So sorry, can't help you. Anybody else?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.