I wrote a simple script to upload a csv file and then update a database table. However, even though I am getting a temp $_FILES['update']['tmp_name'] path, the file is not at this location on the server. Does anyone know what this means? could it be a permissions issue? This is a Godaddy shared hosting account.
Here's my form and the handler (the database piece is not in place yet. I'm just trying to get file contents at this point):
<div class="admin-section" style="margin-left:10%;">
<?php
if ( !empty($_POST['uploadFile']) ) {
$name = $_FILES['update']['name'];
echo $_FILES['update']['type'] . '<br />';
echo $_FILES['update']['size'] . '<br />';
$path = $_FILES['update']['tmp_name'];
echo $_FILES['update']['error'] . '<br />';
$file = $path . '/' . $name;
$file_open = fopen($file, 'r');
$data = fgetcsv( $file_open, 1000, ',');
print_r($data);
}
?>
<form enctype="multipart/form-data" action="#" method=post>
<label>Select a CSV or XLS file to up load from your computer</label><br />
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="hidden" name="uploadFile" value="yes" />
<input type=file name=update />
</p>
<p>
<input type=submit name=Upload />
</p>
</form>
</div>
The error I get is fopen(/tmp/php05Lebo/certificate-users.csv): failed to open stream: No such file or directory, and sure enough, that folder does not exist in /tmp. Thanks!