|
-
Apr 28th, 2002, 05:51 PM
#1
Thread Starter
Hyperactive Member
Upload
How can I Upload this file to my website using php code
C:\file.txt
-
Apr 28th, 2002, 05:54 PM
#2
PowerPoster
-
Apr 29th, 2002, 02:17 AM
#3
Thread Starter
Hyperactive Member
I try
I try That
copy ("C:\file.jpg", "/image");
but it does not work
What is the error ?
-
Apr 29th, 2002, 07:41 AM
#4
it has to be in this form.
PHP Code:
if (!copy(source, destination)) {
print ("failed to copy file...<br>\n");
}
exactly, what is the error you are getting?
-
Apr 29th, 2002, 10:58 AM
#5
Thread Starter
Hyperactive Member
Code and Error
I used this code
<?
if (!copy("C:\t\ttt.gif","./ttt.gif")) {
print ("failed to copy file...<br>\n");
}
?>
Error:
Warning: Unable to open 'C: tt.gif' for reading: No such file or directory in /home/vbzoom/public_html/vb-chat/copy.php on line 3
failed to copy file
-
Apr 29th, 2002, 11:03 AM
#6
<?
if (!copy("C:\t\ttt.gif","./image")) {
print ("failed to copy file...<br>\n");
}
?>
but I am not sure why you don't want to use a form to upload the file which makes it a lot easier. I am really not positive that you can do it this way.
-
Apr 29th, 2002, 11:25 AM
#7
Stuck in the 80s
Re: Code and Error
I might be wrong, but try this:
<?
if (!copy("C:\\ttt.gif","./ttt.gif")) {
print ("failed to copy file...<br>\n");
}
?>
Not the difference between it and yours.
-
Apr 29th, 2002, 12:43 PM
#8
ok you have to use a form. you can't upload form C: like you want.
I just tried it and it doesn't work. probably some security thing. also you might have to have this so it knows what to do.
<form ENCTYPE="multipart/form-data"
-
Apr 29th, 2002, 02:28 PM
#9
Thread Starter
Hyperactive Member
the same file
I want to upload the same file every time I run this script without use form . I can not do that ??
Thanks
-
Apr 29th, 2002, 02:51 PM
#10
well you could use the form and make the input hard coded.
<input type=file value="C:\t\ttt.gif" name="myfile">
something like that should work. can't see whay you would want to upload a gif once a day.
-
Apr 29th, 2002, 03:31 PM
#11
Thread Starter
Hyperactive Member
-
Apr 29th, 2002, 04:37 PM
#12
Fanatic Member
for the paths thing try using
\\t or //t instead of \t
with the \t it might think its a tab
hobo has the idea
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 29th, 2002, 05:08 PM
#13
don't you think I have tried that. php doesn't know what is going on if it doesn't have the form headers from the form
<form ENCTYPE="multipart/form-data"
if the file is not in the tmp upload directory then it will not upload it. I tried all thoughs that were suggested.
if that is the case then everytime you went to my site I could upload a win.ini form your computer and then delete it and then your computer would not start. very big secrutiy risk here.
-
Apr 30th, 2002, 05:16 AM
#14
Thread Starter
Hyperactive Member
is not work
well you could use the form and make the input hard coded.
<input type=file value="C:\t\ttt.gif" name="myfile">
something like that should work. can't see whay you would want to upload a gif once a day
I try that but it does not work.
(input type=file) is not accept value
------
There is any way to upload this file using my UserName and Password of my site such as FTP but using PHP CODE ??????
Last edited by prokhaled; Apr 30th, 2002 at 05:20 AM.
-
Apr 30th, 2002, 05:56 AM
#15
Fanatic Member
Re: is not work
try
<input type=file value="C:\\t\\ttt.gif" name="myfile">
it thinks the \t's are tabs
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 30th, 2002, 06:13 AM
#16
Thread Starter
Hyperactive Member
is not work
(input type=file) is not accept any value at all.
-
Apr 30th, 2002, 07:22 AM
#17
then you will have to insert it everytime and do it the old fashion way.
<form>
<input type="file" name="userfile">
</form>
then you can use the copy from above.
-
May 3rd, 2002, 05:41 PM
#18
Member
-
May 3rd, 2002, 06:02 PM
#19
questions on your tutorial.
FAQ:
Q: I want to specify a different default folder where files should be uploaded instead of the server "temp" folder -
A: Use the "upload_tmp_dir" directive within php.ini - set it to your target folder
that is a littel misleading. what ever you make the upload_tmp_dir is still a temp directory an dif you don't move it out within a certain time the server deletes it on cleanup.
also $HTTP_POST_FILES is deprecated and won't be used in future versions of php as of 4.1.2 everybody should be up to that version at least do to some security issues. also in the future versions of php, register_globals will be turn off as recommended by php. so $HTTP_POST_FILES will not work and you have to use $_FILES[] to do the work.
good tutorial otherwise...
-
May 4th, 2002, 02:19 PM
#20
Member
Originally posted by scoutt
questions on your tutorial.
that is a littel misleading. what ever you make the upload_tmp_dir is still a temp directory an dif you don't move it out within a certain time the server deletes it on cleanup.
also $HTTP_POST_FILES is deprecated and won't be used in future versions of php as of 4.1.2 everybody should be up to that version at least do to some security issues. also in the future versions of php, register_globals will be turn off as recommended by php. so $HTTP_POST_FILES will not work and you have to use $_FILES[] to do the work.
good tutorial otherwise...
Thanks dude. Updated the tutorial with your errata. Lemme know if anything else is wrong...
-
May 4th, 2002, 04:41 PM
#21
looks good.
The file will be deleted from the temporary directory at the end of the request if it has not been moved away or renamed.
lookk here at the very end right before the comments
http://www.php.net/manual/en/features.file-upload.php
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|