| | |
PHP Upload
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2007
Posts: 23
Reputation:
Solved Threads: 0
I am trying to find a simple script to upload some php files to my webserver.
I do not have ftp access over than via a GUI for the provider which sucks, I have a script running on my local server to make some file changes, I then want to put those files onto my remote server so users can see the updated info.
Does anyone know of a way I can do this that wont involve scripting an fwrite with multiple lines as there will be several pages and several hundred lines to copy.
I do not have ftp access over than via a GUI for the provider which sucks, I have a script running on my local server to make some file changes, I then want to put those files onto my remote server so users can see the updated info.
Does anyone know of a way I can do this that wont involve scripting an fwrite with multiple lines as there will be several pages and several hundred lines to copy.
•
•
Join Date: Sep 2009
Posts: 2
Reputation:
Solved Threads: 0
Hi,
use following function.
function UploadOne($fname)
{
if (is_uploaded_file($fname['tmp_name']))
{
$filname = $curtime."_".basename($fname['name']);
$uploadfile = $uploaddir . $curtime."_".basename($fname['name']);
$copyfile = $copyfile . $curtime."_".basename($fname['name']);
if (move_uploaded_file ($fname['tmp_name'], $uploadfile))
{
$res = "File has been successfully uploaded and stored.<br>";
}
else
$res = "Could not move ".$fname['tmp_name']." to ".$uploadfile."<br>";
}
else
$res = "File ".$fname['name']." failed to upload.";
return ($res);
}
Call this function and send a filename with path as parameter.
use following function.
function UploadOne($fname)
{
if (is_uploaded_file($fname['tmp_name']))
{
$filname = $curtime."_".basename($fname['name']);
$uploadfile = $uploaddir . $curtime."_".basename($fname['name']);
$copyfile = $copyfile . $curtime."_".basename($fname['name']);
if (move_uploaded_file ($fname['tmp_name'], $uploadfile))
{
$res = "File has been successfully uploaded and stored.<br>";
}
else
$res = "Could not move ".$fname['tmp_name']." to ".$uploadfile."<br>";
}
else
$res = "File ".$fname['name']." failed to upload.";
return ($res);
}
Call this function and send a filename with path as parameter.
•
•
•
•
I am trying to find a simple script to upload some php files to my webserver.
I do not have ftp access over than via a GUI for the provider which sucks, I have a script running on my local server to make some file changes, I then want to put those files onto my remote server so users can see the updated info.
Does anyone know of a way I can do this that wont involve scripting an fwrite with multiple lines as there will be several pages and several hundred lines to copy.
![]() |
Similar Threads
- Upload file via PHP upload form. (VB.NET)
- php upload mysql (PHP)
- Php upload file script help (PHP)
- Php upload photos script (PHP)
- need help: file upload using php (PHP)
- How to upload a file in PHP ? (PHP)
Other Threads in the PHP Forum
- Previous Thread: Javascript Date Validator onChange Questions
- Next Thread: Get Directory Listing
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation download dynamic echo email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link login loop mail menu mlm mod_rewrite multiple mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validation validator variable video web xml youtube





