Jump to content
php.lv forumi

Failu ielāde


vostro

Recommended Posts

Sveiki visiem!

Vai ir iespējams šādā veidā dabūt failu mapē uploads ?

HTML

  <form action="#" method="post"
       	enctype="multipart/form-data">
       	<label for="file">Bilde:</label>
       	<input type="file" name="file" id="file" />
       	<br />
   	</form>

 

JS

$('#file').change(function (){
  	var photo = $('#file').val();
  	$.post ('/welcome/upload', {photo:photo}, function (data){
   	alert (data);
  	});

Ja kāds var palīdzēt, uzrakstat darbību PHP pusē, ja tas ir vispār iespējams, bez 'submit' pogas.

PHP

move_uploaded_file nemet mapē uploads

Edited by vostro
Link to comment
Share on other sites

pamēģini aizstāt $.post... ar

$.post("upload.php", {photo:""+photo+""}, function(data){
               	$('#dati').html(data);
       	});

 

iekš <div id="dati"></div> atgriezīs kādu info.

 

Un Upload.php

if(isset($_POST["photo"]))
{
//Upload kods un direktorija kur upload
}

 

Pamēģini šādi varbūt.

Edited by Kracker
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...