Frustrated to foulness with copy() (UPLOADING) 
July 17th, 2005, 11:27 AM
| | | Frustrated to foulness with copy() (UPLOADING)
I have literally spent DAYS experimenting, searching, researching
RTFM'g;
and I STILL can NOT get copy() to work.
If I wrote this message the way I've been talking - there'd be an "F"
word sprinkled between almost every word. I'll spare you that - you can
insert them yourself... :)
Apparently I must be the ONLY person that wants to upload a KNOWN file
from a KNOWN path WITHOUT using a form.
I can easily get the copy() function to work using the examples in PHP
manual.
(ie: using <input type=file> in a <form>, calling into my php script).
I have [several] files that I want to repeatedly upload to a web site
(thus keeping these files current).
I SHOULD be able to do this in 1 simple script - shouldn't I?????
I've tried EVERY permutation I can think of, and many I couldn't; and
NOTHING works.
Could someone please enlighten me - WHY THE ---- DOESN'T this work:
??????
<?
$cpfrom="d:\\temp\\blank_ms.txt";
$cpto="./upload/junk.txt";
if (!copy($cpfrom,$cpto)) print "this blanking is STILL not wrkg<BR>";
if (!copy("$cpfrom","$cpto")) print "this blanking is STILL not
wrkg<BR>";
if (!copy(stripslashes($cpfrom),"$cpto"))
print "this blanking is STILL not wrkg<BR>";
if (!copy(stripslashes($cpfrom),$cpto))
print "this blanking is STILL not wrkg<BR>";
// there's probably another 10 variations
$cpfrom="d:\temp\blank_ms.txt";
// REPEAT ABOVE tests
$cpfrom="d:/temp/blank_ms.txt";
// REPEAT ABOVE tests
$cpfrom="d%3A%5Ctemp%5Cblank_ms.txt";
// REPEAT ABOVE tests
$cpfrom="file:///d/temp/blank_ms.txt";
// REPEAT ABOVE tests
?>
ANY help VERY much appreciated!!!
10k TIA | 
July 17th, 2005, 11:27 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
*** h@s@n@starnetwx.net escribió/wrote (11 Feb 2005 10:04:03 -0800):[color=blue]
> Could someone please enlighten me - WHY THE ---- DOESN'T this work:
> ??????
>
> <?
> $cpfrom="d:\\temp\\blank_ms.txt";
> $cpto="./upload/junk.txt";[/color]
Do these paths belong to the same computer? (The first ones uses \ as in
Windows and the second one / as in Unix.)
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
-- | 
July 17th, 2005, 11:27 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
h@s@n@starnetwx.net wrote:[color=blue]
> I have literally spent DAYS experimenting, searching, researching
> RTFM'g;
> and I STILL can NOT get copy() to work.
>
> If I wrote this message the way I've been talking - there'd be an "F"
> word sprinkled between almost every word. I'll spare you that - you can
> insert them yourself... :)
>
> Apparently I must be the ONLY person that wants to upload a KNOWN file
> from a KNOWN path WITHOUT using a form.
>
> I can easily get the copy() function to work using the examples in PHP
> manual.
> (ie: using <input type=file> in a <form>, calling into my php script).
>
> I have [several] files that I want to repeatedly upload to a web site
> (thus keeping these files current).
>
> I SHOULD be able to do this in 1 simple script - shouldn't I?????
> I've tried EVERY permutation I can think of, and many I couldn't; and
> NOTHING works.
>
> Could someone please enlighten me - WHY THE ---- DOESN'T this work:
> ??????
>
> <?
> $cpfrom="d:\\temp\\blank_ms.txt";
> $cpto="./upload/junk.txt";
> if (!copy($cpfrom,$cpto)) print "this blanking is STILL not wrkg<BR>";
> if (!copy("$cpfrom","$cpto")) print "this blanking is STILL not
> wrkg<BR>";
> if (!copy(stripslashes($cpfrom),"$cpto"))
> print "this blanking is STILL not wrkg<BR>";
> if (!copy(stripslashes($cpfrom),$cpto))
> print "this blanking is STILL not wrkg<BR>";
> // there's probably another 10 variations
> $cpfrom="d:\temp\blank_ms.txt";
> // REPEAT ABOVE tests
> $cpfrom="d:/temp/blank_ms.txt";
> // REPEAT ABOVE tests
> $cpfrom="d%3A%5Ctemp%5Cblank_ms.txt";
> // REPEAT ABOVE tests
> $cpfrom="file:///d/temp/blank_ms.txt";
> // REPEAT ABOVE tests
> ?>
>
>
> ANY help VERY much appreciated!!!
>
> 10k TIA?
>[/color]
why aren't you looking at the error message?
why not set error_reporting to all?
what is the size of the file, and what is the max_upload_filesize set to?
what is file_uploads set to?
is there a problem with upload_tmp_dir? | 
July 17th, 2005, 11:28 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
It's hard to tell why your COPY is not working. You must provide any
errors you are getting before people can help.
However, instead of using COPY, you could also try:
fopen, fread, fwrite. | 
July 17th, 2005, 11:28 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
Alvaro G. Vicario wrote:[color=blue]
> *** h@s@n@starnetwx.net escribió/wrote (11 Feb 2005 10:04:03 -0800):[color=green]
> > Could someone please enlighten me - WHY THE ---- DOESN'T this work:
> > ??????
> >
> > <?
> > $cpfrom="d:\\temp\\blank_ms.txt";
> > $cpto="./upload/junk.txt";[/color]
>
> Do these paths belong to the same computer? (The first ones uses \ as[/color]
in[color=blue]
> Windows and the second one / as in Unix.)[/color]
yep - should have said that -
I'm uploading from a windows desktop to a unix server. | 
July 17th, 2005, 11:28 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
Steve wrote:[color=blue]
> h@s@n@starnetwx.net wrote:[color=green]
> > Could someone please enlighten me - WHY THE ---- DOESN'T this work:
> > ??????
> >
> > <?
> > $cpfrom="d:\\temp\\blank_ms.txt";
> > $cpto="./upload/junk.txt";
> > if (!copy($cpfrom,$cpto)) print "this blanking is STILL not[/color][/color]
wrkg<BR>";[color=blue][color=green]
> >
> > ANY help VERY much appreciated!!!
> >[/color]
> why aren't you looking at the error message?
>
> why not set error_reporting to all?
> what is the size of the file, and what is the max_upload_filesize set[/color]
to?[color=blue]
> what is file_uploads set to?
> is there a problem with upload_tmp_dir?[/color]
sorry - should have included that info too...
WHEN I get an error, which isn't all the time, it's meaningless.
It would tell me something completely untrue.
the file is only 200 bytes in size (although the final one is bigger),
but doesn't come anywhere near my max_up_filesize...
I never checked file_uploads, or tmp dir settings, because copy() works
FINE when I'm submitting from a form. Clearly copy works - just not
when I try to use it outside of a form. | 
July 17th, 2005, 11:28 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
phpcode wrote:[color=blue]
> It's hard to tell why your COPY is not working. You must provide any
> errors you are getting before people can help.
>
> However, instead of using COPY, you could also try:
>
> fopen, fread, fwrite.[/color]
I did consider those functions, but copy is a one-line solution, and
I don't see any reason it should fail....
The only errors I've rcv'd were when I was using incorrect syntax.
none of the copy attempts from above actually generate any displayed
errors, only a boolean false that the copy didn't work. There's no
indication as to WHY it didn't work....
Is there some way to determine what's going on?
(E_ALL errors are set to display)
tia - again... | 
July 17th, 2005, 11:28 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
*** h@s@n@starnetwx.net escribió/wrote (12 Feb 2005 15:26:43 -0800):[color=blue][color=green][color=darkred]
>>> $cpfrom="d:\\temp\\blank_ms.txt";
>>> $cpto="./upload/junk.txt";[/color]
>>
>> Do these paths belong to the same computer? (The first ones uses \ as[/color]
> in[color=green]
>> Windows and the second one / as in Unix.)[/color]
>
> yep - should have said that -
> I'm uploading from a windows desktop to a unix server.[/color]
If your script runs in the Unix server, how do you expect it to reach your
computer hard disc drive?
If it runs in the Windows desktop, what protocol are you trying to use for
the file upload? HTTP file upload, maybe? If so you can't just "copy" the
file, you need to send a POST request and have a script up there to process
it.
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
-- | 
July 17th, 2005, 11:29 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
It would be pretty damn scary if a web server can grab any files from
your harddrive... | 
July 17th, 2005, 11:29 AM
| | | Re: Frustrated to foulness with copy() (UPLOADING)
true enough - in retrospect, I guess I became so obcessed with tunnel
vision, I lost sight of the forest.
I'm not sure what I was thinking.... :)
Of course, that's exactly what the form submit IS doing....
My solution is clear now.....
TX MUCH to all!! | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,989 network members.
|