473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP FTP (French user please)

Hi
Sorry I don't speak english very vell and no reply in fr news ! ! !

Bonjour,

J'essai d'envoyer par FTP en php un fichier dont le nom, la destination
et la source seront toujours les mêmes.

Voici le code : (rien de compliqué)

************************************************** ****************

$source='//srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';
$destination='/var/www/toitetjoie/maj/liste_vacpli.sql';
echo $source."<br>";
echo $destination."<br>";
// paramètres de connexion FTP
$ftp_serveur=('192.168.99.20');
$conn_id=ftp_connect($ftp_serveur);
echo $conn_id."<br>";
$reslogin=ftp_login($conn_id,'cepas','tetj');
echo $reslogin."<br>";
$resput=ftp_put($conn_id,"$destination","$source", FTP_BINARY);
echo $resput."<br>";
ftp_quit($conn_id);

************************************************** ****************

Voici le résultat des echos :

//srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql
/var/www/toitetjoie/maj/liste_vacpli.sql
Resource id #2
1

------------------------------------------------------

Ce que je trouve étrange (mais il y a surement une explication) c'est
que lorsque je passe par un Bt parcourir et l'utilsation de la
viariable $_FILES avec la propriété name, cela fonctionne :

temp=$_FILES['url'];
$_SESSION['vs_pj']=$temp['name'];

Le système gere alors une sorte de fichier temporaire et le ftp
fonctionne...

Merci d'avance pour votre aide précieuse....

Cordialement,

SG
Jan 26 '06 #1
10 1632
Sylvain,

Mais pourquoi tant de " ?

$resput=ftp_put($conn_id,"$destination","$source", FTP_BINARY);
<

Le Manuel PHP dit
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}

Tu as éssayé

$resput=ftp_put($conn_id,$destination,$source,FTP_ BINARY);

??

Lennart Björk
Jan 26 '06 #2
Sylvain GRAVERON wrote:
Sorry I don't speak english very vell and no reply in fr news ! ! !


Salut!

Votre Anglais est bon, vous devriez essayer d'expliquer votre problème
en Anglais.

Your English is good, you should try to explain your problem in English.

Marc
Jan 26 '06 #3
Sylvain GRAVERON wrote:
Hi
Sorry I don't speak english very vell and no reply in fr news ! ! !


Contrary to popular belief, those of us who are ignorant and monolingual
can actually read broken English quite well. It's easier to read broken
(or bad) English than to try and listen to it.

Your English is much better than my <insert any other language here>

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Jan 26 '06 #4
> Sylvain GRAVERON wrote:
Hi
Sorry I don't speak english very vell and no reply in fr news ! ! !


Contrary to popular belief, those of us who are ignorant and monolingual
can actually read broken English quite well. It's easier to read broken
(or bad) English than to try and listen to it.

Your English is much better than my <insert any other language here>


Ok, I try... (sorry=) ;-(

I try do upload on file that i known name and directory in php

Code :

************************************************** ****************

$source='//srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';
$destination='/var/www/toitetjoie/maj/liste_vacpli.sql';
echo $source."<br>";
echo $destination."<br>";
// paramèters FTP
$ftp_serveur=('192.168.99.20');
$conn_id=ftp_connect($ftp_serveur);
echo $conn_id."<br>";
$reslogin=ftp_login($conn_id,'cepas','tetj');
echo $reslogin."<br>";
$resput=ftp_put($conn_id,"$destination","$source", FTP_BINARY);
echo $resput."<br>";
ftp_quit($conn_id);

************************************************** ****************

This de result of echos :

//srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql
/var/www/toitetjoie/maj/liste_vacpli.sql
Resource id #2
1

------------------------------------------------------

If and do the same think with a browse button, it's OK. The system use
$_FILES [name]
temp=$_FILES['url'];
$_SESSION['vs_pj']=$temp['name'];

The system call probably a temporary file and upload

Thank you for help.

Sincerely,

SG
Jan 26 '06 #5
SG
Lennart Björk avait écrit le 26/01/2006 :
Sylvain,

Mais pourquoi tant de " ?
>

$resput=ftp_put($conn_id,"$destination","$source", FTP_BINARY);
<

Le Manuel PHP dit
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}

Tu as éssayé

$resput=ftp_put($conn_id,$destination,$source,FTP_ BINARY);

??

Lennart Björk


Yes

It's don't works.
Maybe i find. I forgot the protocol.
File is on a files server (windows) Monday I will try this :

$source=file:///'srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';

What do you think about this ?

Tks

--
------------------------------------------

Cordialement

SG

Jan 26 '06 #6
Sylvain GRAVERON wrote:
Sylvain GRAVERON wrote:
Hi
Sorry I don't speak english very vell and no reply in fr news ! ! !


Contrary to popular belief, those of us who are ignorant and monolingual
can actually read broken English quite well. It's easier to read broken
(or bad) English than to try and listen to it.

Your English is much better than my <insert any other language here>


Ok, I try... (sorry=) ;-(

I try do upload on file that i known name and directory in php

Code :

************************************************** ****************

$source='//srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';
$destination='/var/www/toitetjoie/maj/liste_vacpli.sql';
echo $source."<br>";
echo $destination."<br>";
// paramèters FTP
$ftp_serveur=('192.168.99.20');
$conn_id=ftp_connect($ftp_serveur);
echo $conn_id."<br>";
$reslogin=ftp_login($conn_id,'cepas','tetj');
echo $reslogin."<br>";
$resput=ftp_put($conn_id,"$destination","$source", FTP_BINARY);
echo $resput."<br>";
ftp_quit($conn_id);

************************************************** ****************

This de result of echos :

//srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql
/var/www/toitetjoie/maj/liste_vacpli.sql
Resource id #2
1

------------------------------------------------------

If and do the same think with a browse button, it's OK. The system use
$_FILES [name]
temp=$_FILES['url'];
$_SESSION['vs_pj']=$temp['name'];

The system call probably a temporary file and upload

Thank you for help.


I'm thinking that your problem is the source file. You reference it
starting with "//"

try adding something like this to check on that:

var_dump(file_exists($source));

if you get "bool(false)" then your problem is there. In order to put the
file somewhere, the system needs to know where the source is. If it
doesn't think it exists, then you can't successfully upload it...
BTW - your english isn't that bad at all. Definitely enough to get the
message across. ;)

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Jan 26 '06 #7
Sylvain,
$source=file:///'srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';

What do you think about this ?
<

I think you should start by checking if the file really is there (or
even available to you there). Justin Koivisto gives you that hint in his
message here.

As a general rule I think you schould check the results of your actions.
You mentioned that you got
Resource id #2
1
<
What does that '1' mean? Isn't that the result of your

$resput=ftp_put($conn_id,"$destination","$source", FTP_BINARY);
<
?
The result of the ftp_put() seems to be ok. But if there is nothing to
put nothing is put, bien que le put lui-même marche très bien. You can
test how ftp_put() works in this respect by asking it to send something
you know is not there, and keep a tight eye on the return value.

Lennart Björk
Jan 27 '06 #8
Lennart Björk wrote:
Sylvain,
> $source=file:///'srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';

What do you think about this ?
<


"file:" would only work if accessible through local filesystem.

I think you should start by checking if the file really is there (or
even available to you there). Justin Koivisto gives you that hint in his
message here.


Quite so.

As far as I know, PHP has no wrapper for the smb-protocol so, unless
natively supported by the OS, PHP cannot directly access shared
folders on remote windows servers.

Perhaps the simplest would be to let the linux (or what have you),
access the windows server through http or ftp.
/Bent

[snip]
Jan 27 '06 #9
SG
Bent Stigsen a pensé très fort :
Lennart Björk wrote:
Sylvain,
>

$source=file:///'srv-fic01/TeJCommun/site_web_admin/liste_vacpli.sql';

What do you think about this ?
<


"file:" would only work if accessible through local filesystem.

I think you should start by checking if the file really is there (or even
available to you there). Justin Koivisto gives you that hint in his message
here.


Quite so.

As far as I know, PHP has no wrapper for the smb-protocol so, unless natively
supported by the OS, PHP cannot directly access shared folders on remote
windows servers.

Perhaps the simplest would be to let the linux (or what have you), access the
windows server through http or ftp.
/Bent

[snip]


Ok,
i'll try with ftp or http on my win2003 to My debian. (My debian is
installed with samba... Maybe ! ! !)

I try monday and i 'll say to you the result.

:'( I known my english is very very BAAAAAAAAAD ! ! ! !

SG

--
------------------------------------------

Cordialement

SG
Jan 27 '06 #10
SG wrote:
[snip]
i'll try with ftp or http on my win2003 to My debian. (My debian is
installed with samba... Maybe ! ! !)
Yes, that is also an option.

For example, if the share is open to anonymous access then try:
smbclient -N //srv-fic01/TeJCommun/site_web_admin/

If ok, then you should get a prompt like:
smb: \>

smbclient is just like a ftp client, where you can get and put files.
? will give list of commands.

If above is ok, then you could mount the share on the local
filesystem, with:

mount -t smbfs -o guest //srv-fic01/TeJCommun/site_web_admin/ /mnt/xyz

And then access the files from /mnt/xyz (or whereever)

If username and password is required for accessing the windows server,
then look at the man-pages for smbclient and smbmnt.

I haven't used the above myself, so I can't say how stable it is. I
might be a bit critical, but I would try to reboot either machines,
and see if it reconnects properly. And just to be safe, have a
cron-job do a check once every hour.

I try monday and i 'll say to you the result.

:'( I known my english is very very BAAAAAAAAAD ! ! ! !


It is really not as bad as you think. The fact that you can see your
own limitation is a good sign.

Use it, and it *will* get better.
/Bent
Jan 27 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Haines Brown | last post by:
I'm having trouble finding the character entity for the French abbreviation for "number" (capital N followed by a small supercript o, period). My references are not listing it. Where would I...
1
by: Gina | last post by:
Hi everybody: I need some help to load in the as/400, a file with fields that have french characters . I have created a file with language = FRC and ccsid = 500 and also I have tried with ccsid =...
8
by: Ess355 | last post by:
Hi, In the debugger at run time, characters like é are not recognised by their normal ASCII number, but something like -8615722... . I've seen this number before, it means "rubbish" right? So...
13
by: jd | last post by:
I have just spent the past week reading up on locales in books by Josuttis and Stroustrup. As a simple test of locales, I prepared the following source code below. The purpose is to convert the...
9
by: kaustubh.deo | last post by:
I am facing issues printing french chars like using printf function. I have reproduced this issue with simple C program as follows. #include <stdio.h> #include <locale.h> int main(int...
2
by: Marcel Saucier | last post by:
Hi Everybody, At run time, regardless of the computer regional settings, is there a simple way of swtiching the DateTime Picker in French (fr-CA) or in English (en-US) depending of the user...
1
by: bssjohn | last post by:
Dear All, I have developing a French website using PHP & Ajax. In that I tried to display some French texts from mysql database using Ajax. Form local I got the text from db with Correct accents...
3
by: bss | last post by:
Dear All, I have developing a French website using PHP & Ajax. In that I tried to display some French texts from mysql database using Ajax. Form local I got the text from db with Correct...
7
chunk1978
by: chunk1978 | last post by:
i though i had this under control, but i'm completely lost... i have a form which allows a user to fill out information, which is then emailed to myself as well as themselves... the form is...
0
by: shintu | last post by:
Hallo, I am trying to write french accented characters é è ê in Excel worksheet using my perl script , But I am stuck here as I couldnt find a way of writing it !: My code: use strict;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
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...

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.