Programming and Webmasters forum
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Sending attached files in php !

 
webmaster forum
Anchor  Offline
 
New Coder
Posts: 20
Topics: 16
January 13, 2009, 04:45:11 AM

Could you please help realize the procedure of sending attached files in php. If it is possible, please, provide me with ready code examples. Thanks in advance!
 
webmaster forum
polas  Offline
*
 
Code Guru
Gender: Male
Posts: 1296
Topics: 79
WWW
January 13, 2009, 06:28:10 AM

What do you actually want to achieve? - its not clear from your post. To get the user uploading a file and handling it, have some html

Code:
<form action="myaction.php" method="POST">
 <input type="file" name"userfile">
</form>

Now have a file (myaction.php) which is similar to

Code:
<?php
$tmp_name 
$_FILES["userfile"]["tmp_name"];
$name $_FILES["userfile"]["name"];
move_uploaded_file($tmp_name"data/$name");
?>


This will copy the file from its temp name (as on the server) into data/file name.

For more information, look at http://uk3.php.net/manual/en/features.file-upload.post-method.php

Of course, you could also open the temp file and look at its contents or what ever you wanted

Mesham Type Oriented Parallel Programming Language
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC


Google visited last this page August 13, 2010, 09:08:35 PM