Jump to content

File Upload Problem


rclark

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.