rclark Posted October 7, 2009 Share Posted October 7, 2009 Hi All, Noobie here. I am having problems uploading a file. $_FILES is empty ! What am I doing wrong? Thanks in advance! function Process($uploadFile, $GroupCode){ #nothing for now } ?> <form method="POST" action="<?php $uri =& JURI::getInstance(); echo $uri->base(); ?>index.php?option=com_utilitysetup1" name="frmcart" id="frmcart"> Select File: <input type="file" name="uploadFile" accept = "application/csv,text/comma-separated-values,text"/csv><br> <input type="hidden" name="task" value="" /> <input type="button" name="send" value="Process" class="button" onclick="DoSomething()" /> <script language="javascript"> function DoSomething(){ var form=document.frmcart; form.task.value="upload"; form.submit(); } </script> <?php $task = JRequest::getVar('task', ''); if (!$task){ } else { if ($task == "upload" ){ echo "<pre>"; echo "FILES:"; print_r($_FILES); echo "</pre>"; Process($uploadFile, $GroupCode); } } ?> </form> <?php ?> Link to comment https://forums.phpfreaks.com/topic/176781-file-upload-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 7, 2009 Share Posted October 7, 2009 Your <form ...> tag needs the following in order for an upload to work - enctype="multipart/form-data" Link to comment https://forums.phpfreaks.com/topic/176781-file-upload-problem/#findComment-932094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.