Connecting Tech Pros Worldwide Help | Site Map

Frustrated to foulness with copy() (UPLOADING)

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 11:27 AM
h@s@n@starnetwx.net
Guest
 
Posts: n/a
Default 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


  #2  
Old July 17th, 2005, 11:27 AM
Alvaro G. Vicario
Guest
 
Posts: n/a
Default 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
--
  #3  
Old July 17th, 2005, 11:27 AM
Steve
Guest
 
Posts: n/a
Default 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?


  #4  
Old July 17th, 2005, 11:28 AM
phpcode
Guest
 
Posts: n/a
Default 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.

  #5  
Old July 17th, 2005, 11:28 AM
h@s@n@starnetwx.net
Guest
 
Posts: n/a
Default 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.

  #6  
Old July 17th, 2005, 11:28 AM
h@s@n@starnetwx.net
Guest
 
Posts: n/a
Default 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.

  #7  
Old July 17th, 2005, 11:28 AM
h@s@n@starnetwx.net
Guest
 
Posts: n/a
Default 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...

  #8  
Old July 17th, 2005, 11:28 AM
Alvaro G. Vicario
Guest
 
Posts: n/a
Default 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
--
  #9  
Old July 17th, 2005, 11:29 AM
chernyshevsky@hotmail.com
Guest
 
Posts: n/a
Default Re: Frustrated to foulness with copy() (UPLOADING)

It would be pretty damn scary if a web server can grab any files from
your harddrive...

  #10  
Old July 17th, 2005, 11:29 AM
h@s@n@starnetwx.net
Guest
 
Posts: n/a
Default 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!!

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

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.