473,503 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ftp_get() on new domain won't download files

unicorn
23 New Member
Hi guys,

I have moved my site from one domain to another. it worked perfectly on old domain, ftp_put(), ftp_delete() - i.e. FTP upload and remove scripts work fine, but... i have problem using ftp_get() wicth shows me error, and says :

Warning: ftp_get() [function.ftp-get]: Error opening 4.gif in /home/mydomain/public_html/down_att.php on line 43

Couldn't download file '4.gif' .


i have checked connection, path. well if i change path (ftp directory) to this file it gives me error that it cannot find this file on this path, so path is correct.

i have checked directories, filename, permissions. i have no clue why it doesn work, i appriciate your advice, thanks.
Jul 18 '07 #1
13 4393
pbmods
5,821 Recognized Expert Expert
Heya, unicorn.

i have checked connection, path. well if i change path (ftp directory) to this file it gives me error that it cannot find this file on this path, so path is correct.
I'm confused. If you tried the path, and it said that it couldn't find the file, doesn't that mean that the path is *not* correct?
Jul 18 '07 #2
pbmods
5,821 Recognized Expert Expert
Changed thread title to better describe the problem.
Jul 18 '07 #3
unicorn
23 New Member
read more carefully, i said 'when' i changed path from 'correct' path to 'incorrect' path, it showed me error that file is not found, that means that when path was correct, it could see file, but couldn't read it. thanks...
Jul 18 '07 #4
pbmods
5,821 Recognized Expert Expert
Ok, so what you're saying is if you were to drop into your command line, fire up ftp and attempt to GET the image at the path that you are currently using, ftp will download the file without a hitch.

But when you try more or less the same thing in PHP, you get the error.

Is this correct?
Jul 18 '07 #5
unicorn
23 New Member
Ok, so what you're saying is if you were to drop into your command line, fire up ftp and attempt to GET the image at the path that you are currently using, ftp will download the file without a hitch.

But when you try more or less the same thing in PHP, you get the error.

Is this correct?
yes exactly, if i access file (image or whatever) through command line or ftp manager, there is no problem, i can write, delete, do whatever i want to this files in that directory but cannot download. i wrote hosters, but thay said that maybe my ip addres is blocked :) i've never heard anything more silly... if it is blocked how can i WRITE or DELETE files through PHP commands... oh, and this files are not in common directlry (public_html), because i want to prevent direct access...

first i thought that maybe there are some problems with permissions on /tmp directory (probably place where it copies file till it sends file) but i've sett all permissions to 0777...

thank you for your soon reply :)
Jul 18 '07 #6
pbmods
5,821 Recognized Expert Expert
Oh. Then I have no idea.

Haha Just kidding!

Ok. So there's some kind of error when you attempt to ftp_get() the file.

Couple of ideas rattling around in my head right now:
  • Is the problem specifically related to ftp_get()? In other words, can you include() or file_get_contents()?
  • Can you read a file in the same directory? What if you moved the file to a different directory?
  • Are there any symbolic links in the path (ok, so now I'm grasping at straws)?

Also, is ftp_get() giving you the 'Error opening 4.gif' warning, or is that a custom trigger_error()? What does your error_log say?
Jul 18 '07 #7
unicorn
23 New Member
Oh. Then I have no idea.

Haha Just kidding!

Ok. So there's some kind of error when you attempt to ftp_get() the file.

Couple of ideas rattling around in my head right now:
  • Is the problem specifically related to ftp_get()? In other words, can you include() or file_get_contents()?
  • Can you read a file in the same directory? What if you moved the file to a different directory?
  • Are there any symbolic links in the path (ok, so now I'm grasping at straws)?

Also, is ftp_get() giving you the 'Error opening 4.gif' warning, or is that a custom trigger_error()? What does your error_log say?
ok, here we go:

i have tryed to GET other files in other directories (including php script folder and root folder), it gives same error. in error log it says:

ftp_get() [<a href='function.ftp-get'>function.ftp-get</a>]: Error opening 4.gif in /home/ mydomain/public_html/down_att.php on line 43

in download script i'm using include() to include script with functions and to include configuration file. and i doesnt give me any error and functions work (i have checked in output stream).

and there are not symbolic characters in path, (i have tryed root folder...) only alphabet & numeric.

thank you again.
Jul 19 '07 #8
pbmods
5,821 Recognized Expert Expert
Heya, Unicorn.

I've posted a note on our PHP Expert panel. Hopefully we can get some more brains pondering over this problem.
Jul 19 '07 #9
unicorn
23 New Member
Heya, Unicorn.

I've posted a note on our PHP Expert panel. Hopefully we can get some more brains pondering over this problem.
thanks a lot. i hope i will receive normal answer from hoster too :)
Jul 19 '07 #10
Banfa
9,065 Recognized Expert Moderator Expert
When it says failed to open 4.gif is that the remote or local file?

You say you have checked directory permissions, what are they set to.

How about posting down_att.php for us to see or al leats the code around line 43.
Jul 19 '07 #11
kovik
1,044 Recognized Expert Top Contributor
Yes, show some code and let us know what the permissions are on the file as well (not just the directory, the file itself).
Jul 21 '07 #12
Motoma
3,237 Recognized Expert Specialist
This is a message so I can subscribe to the thread. We will need to see the code you are using in order to get some insight into the way your script is working.
Jul 23 '07 #13
r4ccoon
3 New Member
maybe you want to use ftp_chdir function..to change directory to your file,
and then use ftp_get to get your file, remember that use filename without path, like "4.gif"
Jul 24 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1923
by: John | last post by:
Are there any precautions that I should take when downloading a file from a remote file on Linux platform to a local file in Win98 platform? I am using the method ftp_get $remotefile =...
27
3230
by: Tim Tyler | last post by:
Are there many PHP public domain projects out there? I'm particularly interested in CMS project materials. So far - outside of my own projects - I've found /very/ little PD PHP material out...
0
1667
by: rstuckart | last post by:
A script successfully connects to a remote server, logs in, reports the size of a file on the server. The problem is that it will not download the file with either ftp_get or ftp_fget. The...
1
1962
by: ralphNOSPAM | last post by:
I'm trying to download a text file named KLAX.TXT at tgftp.nws.noaa.gov using if (ftp_get($conn_id, "Metar Reports/$local_file", $server_file, FTP_BINARY)) { print "Success";
5
5512
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...
2
1695
by: cxian | last post by:
Hi all, I am trying to download files from a remote with the use of ftp_get. Somehow, the script always return to false. Here's what I got: $conn_id = ftp_connect($ftp_host);...
1
1757
by: irfan.mohammed | last post by:
Dear All, I need your help,i am using ftp_get for getting the file from remote machine.now i am able to save only at one location.i want the user to select the directory any where in the...
2
4966
by: empiresolutions | last post by:
I am using ftp_get to transfer a file from a secure location, to a temp location. (working) Once at the temp location i need to have the file automatically download to the clients local machine....
1
1638
by: marcarlem | last post by:
Sorry about my english but it´s not my first lenaguage. i got a problem using ftp_get. My FTP server is working properly (I can upload and download files to it) but when I try to download a File...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
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...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7008
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...
0
7467
tracyyun
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...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
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...
0
1521
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 ...
0
399
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.