Can you grab a file with PHP through a form with $_SERVER['PHP_SELF']; action? -


i have email attachment form working fine when <form action="processingtheformfile.php"> sent php file process.

however, when try implement same idea form <form action="<?php echo $_server['php_self']; ?>"> , use

if(isset($_post['submit'])) { $tmp_name = $_files['filename']['tmp_name']; $type = $_files['filename']['type']; $name = $_files['filename']['name']; $size = $_files['filename']['size']; 

before html of file, attachment ends being noname.txt everytime, regardless of file type.

is because $_files cannot work on <?php echo $_server['php_self']; ?> action, or should elsewhere dilemna?

pray makes sense....

forms used uploading files need have enctype="multipart/form-data" make work. here's example:

<form method="post" enctype="multipart/form-data" action=""> 

although report first form works properly, i'm not sure works reliably in cases. make sure has value enctype it'll work properly.


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -