I'm trying to write a script for my users to be able to upload large
files, and now I am unsure what exactly I am doing wrong. My script
is based on the one in the PHP manual.
<?php
if(isset( $Submit ))
{
$ftp_server = "ftp_site";
$ftp_user_name = "username";
$ftp_user_pass = "password";
$source_file = $_FILES['imagefile']['name'];
$destination_fi le = "C:\\Progra~1\\ Ensim\\Sitedata \\jcmarko\\Inet pub\\wwwroot\\f ilevault\\ftp\\ "
.. $_FILES['imagefile']['tmp_name'];
// set up basic connection
$conn_id = ftp_connect($ft p_server);
// login with username and password
$login_result = ftp_login($conn _id, $ftp_user_name, $ftp_user_pass) ;
// check connection
if ((!$conn_id) || (!$login_result )) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name" ;
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name <BR>";
}
// upload the file
ftp_pasv($conn_ id, TRUE);
$upload = ftp_put($conn_i d, $destination_fi le, $source_file,
FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_fi le";
}
// close the FTP stream
ftp_close($conn _id);
}
?>
Some other notes/questions:
1. Is my format for the destination file variable correct? I've put
the complete path on my webhosters server to the directory I want my
users to upload to.
2. Because of some firewall problems, I need to put the transfer in
passive mode. Did I use ftp_pasv correctly?
3. Currently, my users can upload files, but it's through an HTTP
post and I would not like to do that anymore. Using the FTP commands
in PHP, is this still dependent on the settings in php.ini? Am I just
wasting my time if I can get my webhoster to modify their php.ini?
Any assistance as to what I am doing wrong would be greatly
appreciated!
-Joe 0 1813 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Udo Pecher |
last post by:
I apply the following code
test.php
$upload =ftp_put($conn_id,"test.jpg","$dat",FTP-BINARY);
where $dat is a local filename which I like to move via FTP. "test.jpg" ist
the filename on the Web-Server. I start this php-code from HTML with
<FORM ENCTYPE="multipart/form-data" ACTION="test.php" METHOD=POST >
.....
|
by: Christian Giordano |
last post by:
Hi guys, I've an hosting in media temple (appliance-server) with plesk
7.5.1. I'm trying to bring make a CMS I did in another server to work
there. The issues is related the file uploading, in fact a dummy script
like that:
$newname="ciro.jpg";
$uploaddir="test_folder/";
copy($file, $uploaddir.$newname);
unlink($file);
|
by: tripwater |
last post by:
Hello, I am having problems with the ftp_put() function. I can login
via shell prompt.
Does anyone know why the ftp_put() function may not work? I went to the
php site and followed the directions. I am connecting because I am not
getting an error. I am also logging in with the username and password
because I am not getting an error here as well. But so far no matter
what I do, the file will not upload.
Any help with this would be...
|
by: excession |
last post by:
I've got a script which uploads a few files to a remote server. The
problem is the ftp_put command hands and the script eventually times
out. What is even more strange is sometime it works fine.
When it's not working i've check the connectiion and done a manual
upload with a proprietry ftp program and all is fine.
Any ideas?
http://eye.cc -php- web design
|
by: Alex |
last post by:
I'm trying to make simple ftp client, used the following article for base:
http://www.devarticles.com/c/a/PHP/Building-An-FTP-Client-With-PHP/3/
All works, I can login, see list of files, but except ftp_put and ftp_get
functions. They return always false. I tried to set passive mode, it doesn't
help.
Any advice will be appreciated.
| |
by: empiresolutions |
last post by:
ftp_put() is not working. this is what i have.
$host = "www.site.com";
$ftp_user_name = "username";
$ftp_user_pass = "password";
// declair files
$remote_file = "ITS_BLI_0".$_POST.".csv"; // root level
$file = "/upload/ITS_BLI_0".$_POST.".csv"; // this file dir is root/manager/posts/
|
by: Mike |
last post by:
Hi,
I am new to C and having problems with the following program.
Basically I am trying to read some files, loading data structures into
memory for latter searching.
I am trying to use structres and arrays of pointers to them.
I have gotten the program to compile with gcc on WinXP.
If the file i read doesnt have alot of records, it runs thru. But once
i add more, it dies. In this program i have 4 files setup to read. The
|
by: sushil |
last post by:
Hello Frnds,
I am getting problem in uploading file from php
script. The error is :
Code - $upload = ftp_put($conn_id,$filemax,$src,FTP_BINARY);
Output - Resource id #11,fairmont_mon.txt,/tmp/phpWmPlSJ
Warning: ftp_put() : OOPS: vsf_sysutil_bind in
/var/www/html/hview/hqc/twc_upload/upload_file.php on line 263
|
by: PehJota |
last post by:
I'm kinda new to PHP, and I'm trying to make a simple FTP upload script. It successfully connects to the server and logs in, but it can't upload. The transfer mode I use normally is ASCII (like I have it in the script), and for now, I have the mode set to passive (although I'll give a choice later on when I actually implement the script). (I starred out the password here, it is in the file, though.)
Here's the entire page (not much, just the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |