Forum Moderators: coopster

Message Too Old, No Replies

Files uploading not working - URGENT

Files uploading not working - URGENT

         

adnanqureshi

7:01 pm on Aug 19, 2008 (gmt 0)

10+ Year Member



Hi Everyone,
I am trying to upload a file using simple php code, I am able to upload on local php server, however after deploying this on Verio Server, it doesn't work.

I have checked the permissions on both folders (php_tmp_dir and the actuall path I intended to upload that file.
Both directories have read and write access.

Even if i try to get it's value using echo, $_FILES['classnotes']['tmp_name'] browser doesn't display anything.

I have checked the php_tmp_dir, there is no uploaded file there.

Please HELP !

PHP Version 5.2.6

Code:
=====
<form action="<?php print $PHP_SELF?>" enctype="multipart/form-data" method="post">
Last Name:<br /> <input type="text" name="name" value="" /><br />
Class Notes:<br /> <input type="file" name="classnotes" value="" /><br />
<p><input type="submit" name="submit" value="Submit Notes" /></p>
</form>

<?php
define ("FILEREPOSITORY","./");

if (is_uploaded_file($_FILES['classnotes']['tmp_name'])) {

if ($_FILES['classnotes']['type'] != "application/pdf") {
echo "<p>Class notes must be uploaded in PDF format.</p>";
} else {
$name = $_POST['name'];
$result = move_uploaded_file($_FILES['classnotes']['tmp_name'], FILEREPOSITORY."/$name.pdf");
if ($result == 1) echo "<p>File successfully uploaded.</p>";
else echo "<p>There was a problem uploading the file.</p>";
} #endIF
} #endIF
?>

[edited by: adnanqureshi at 7:34 pm (utc) on Aug. 19, 2008]

adnanqureshi

7:18 pm on Aug 19, 2008 (gmt 0)

10+ Year Member



I have checked the value of "php_tmp_dir" on server, and this folder does have read and write permissions.

============================
Still I am getting Error 6 - Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3
============================

Following is the result of print_r($_FILES);

Array ( [classnotes] => Array (
[name] => CMS_FDS_v1.pdf
[type] =>
[tmp_name] =>
[error] => 6
[size] => 0 ) )

[edited by: adnanqureshi at 7:42 pm (utc) on Aug. 19, 2008]

adnanqureshi

7:25 pm on Aug 19, 2008 (gmt 0)

10+ Year Member



The only thing I could find is, Local and Master value of "php_tmp_dir" is different, can this be an issue?
If yes, then on the server, I don't have option to set permission on the Master Value.

coopster

1:18 pm on Aug 20, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, adnanqureshi.

php_tmp_dir
? You mean upload_tmp_dir [php.net]?

adnanqureshi

3:38 pm on Aug 20, 2008 (gmt 0)

10+ Year Member



Ahhh,
yes, you are rite, I meant to say upload_tmp_dir.

adnanqureshi

6:09 pm on Aug 20, 2008 (gmt 0)

10+ Year Member



Alrite, now I got the issue,
Hosting company has now stoped the support for php - isapi mapping, now they only support CGI.

As soon as I switched mapping from ISAPI to CGI, upload started working BUTTT, now there were couple of variables, which were supported only by ISAPI (like DOCUMENT_ROOT), I was using in application are no more working, is there any SMART way to make my application CGI compatable?