Hi @bashy
I have created a dropzone form on my page:
<form class="dropzone dz-clickable" id="dropzonetask" enctype="multipart/form-data" method="POST" action="{{ URL::route('upload-file') }}">
<input type="hidden" name="task_id" value="{{ $task->id }}" />
<div class="dz-message"><center>
<h4>Drag Photos to Upload</h4>
<span>Or click to browse</span></center>
</div>
<button id="uploadall" class="btn btn-default pull-right">Upload All</button>
</form>
you can see i have added an hidden field here.
but when i drag n drop a file on this form it upload the file successfully but wont get task_id value.
here is my controller
public function UploadFile(){
$taskid = Input::get('task_id');
$userid = Auth::user()->id;
$file = Input::file('file');
$destinationPath = public_path().'files';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
$uploadSuccess = $file->move($destinationPath, $filename);
$location = $destinationPath."/".$filename.$extension;
if( $uploadSuccess ) {
$taskfile = TaskFile::create(array(
'task_id' => $taskid,
'user_id' => $userid,
'location' => $location
));
if($taskfile){
return Response::json('success', 200);
}else{
return Response::json('error', 400);
}
} else {
return Response::json('error', 400);
}
}
anything i am doing wrong ?