Programming, website development forum Get latest updates by RSS Follow TechnicalTalk on Twitter Follow TechnicalTalk on Facebook 
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password    
  Forgot your 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
Activity
0%
 
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
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
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, Free online technical support
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.15 | SMF © 2011, Simple Machines


Google visited last this page February 08, 2012, 01:25:33 AM