I am trying to upload a file into the server.. but its not working. im coding in mvc and this is the view file which contains the form data.

<form id="frm" name="frm" method="get" enctype="multipart/form-data" action="">
<input type="file" name="file" /><input type="hidden" name="MAX_FILE_SIZE" value="2000000"/><input type="submit" name="upload" value="upload" /> </form>

this is the controller

if(isset($_GET['upload']))
			{
			
	$fname=$_FILES["file"]["name"];
	$fsize=$_FILES["file"]["size"];
	$ftype=$_FILES["file"]["type"];
	$ftname=$_FILES["file"]["tmp_name"];
						
						echo("$fname". "<br />");
						echo("$fsize". "<br />");
						echo("$ftype". "<br />");
						echo("$ftname". "<br />");
}

When i do it without mvc, using a normal html file uploading works fine.. but using the controller it just wont work. im not so experienced in mvc..i just cant figure it out and its giving me headache.. please some one help me on this...

Recommended Answers

All 3 Replies

How can one send FileData using get method? Use Post method instead.

Oh! thanx :) what a stupid mistake.. Its just i used to use get method for mvc. im really a mvc beginner and i would like to have some clearly explained good resources to read for php in mvc.. can some one give me some good links? to code from scratch before using any frameworks...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.