Ajax File Upload won't Upload!!

If you don't know how to use sth in library or you're doing sth wrong, ask for help here
Forum rules
Only registered users can post

Ajax File Upload won't Upload!!

Postby flippenmusic » Wed Jun 23, 2010 9:03 pm

How can i get this script to actually upload?

http://www.phplivex.com/ajax_file_upload.php

Im using example #2, probably doesn't make a difference, but I am using the script as it shows on that page, everything works. It even transfers the files to 'tmp' folder, but doesn't do its magic and move_uploaded_file to destination folder?

Thanks,
Sean
flippenmusic
Beginner
 
Posts: 3
Joined: Wed Jun 23, 2010 8:50 am

Re: Ajax File Upload won't Upload!!

Postby ardabeyaz » Fri Jun 25, 2010 6:36 am

move_uploaded_file function is your responsibility. See the example #1, a php upload function do the job. That is used by all examples.
Arda Beyazoğlu - Web Developer
PHPLiveX Core Developer
ardabeyaz
Core Developer
 
Posts: 127
Joined: Thu Sep 27, 2007 6:27 pm
Location: Istanbul

Re: Ajax File Upload won't Upload!!

Postby flippenmusic » Sat Jun 26, 2010 6:59 am

well ive tried everything and read through all the pages of code the cgi script and cant figure out why the script wont allow me to upload. im sure its something small im not doing
Code: Select all
<? 
function upload($file_tmp_name, $file_name){ 
    // do not forget to control file type and size 
    move_uploaded_file($file_tmp_name, "uploads/" . $file_name); 

include("PHPLiveX.php"); 
$ajax = new PHPLiveX("upload"); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="phplivex.js"></script>
   <title>upload</title>
</head>
<body>


<? $ajax->Run(); ?> 
<div 
    <div style="float:left;"><input type="file" id="img1" name="img1"></div> 
    <div id="per_img1" style="float:left;">% 0</div> 
</div> 
<div 
    <div style="float:left;"><input type="file" id="img2" name="img2"></div> 
    <div id="per_img2" style="float:left;">% 0</div> 
</div>

<script type="text/javascript">
      PLX.AjaxifyUpload(["img1", "img2"], {
         cgi_path: "upload.cgi",
         tmp_dir: "tmp",
         onProgress: function(progress){
            var percent = document.getElementById("per_" + progress.id);
            percent.innerHTML = "% " + progress.percent;
            if(progress.completed){
               upload(progress.file_tmp_name, progress.file_name, {
                  onFinish: function(response){
                     percent.innerHTML = "Upload progress is completed!";
                  }
               });
            }
         }
      });
      </script>

</body>
</html>


what is doing is creating the temp file and saving it, but im not sure if the script is using it right?? not to sure..

Thanks,
Sean
flippenmusic
Beginner
 
Posts: 3
Joined: Wed Jun 23, 2010 8:50 am

Re: Ajax File Upload won't Upload!!

Postby ardabeyaz » Sun Jun 27, 2010 9:31 am

First, do not include js file manually when ajaxifying php functions. Run method does it already. Your code seems to be correct. Control tmp folder path if temp files are created. If so, see if their file sizes are incresing while uploading (refresh the folder). That means the upload script does work. If it is still not uploading, control your upload script, file permissions, and alert progress attributes inside onProgress callback and see if they are correct.
Arda Beyazoğlu - Web Developer
PHPLiveX Core Developer
ardabeyaz
Core Developer
 
Posts: 127
Joined: Thu Sep 27, 2007 6:27 pm
Location: Istanbul

Re: Ajax File Upload won't Upload!!

Postby flippenmusic » Wed Jul 21, 2010 6:58 am

did everything. still nothing. had it alert me and nothing. maybe could it be the server, which would make all the sense because the script is perfect, read every line. is there anything special at all that this needs?

whats going on is it shows the status percentage of the upload, and it creates the temp files, query, post, etc. but seems to have the problem with move_uploaded_file or any function and finding the temp/var

im lost, script is amazing, but i might have to move on and find another since ive done everything

thanks
sean
flippenmusic
Beginner
 
Posts: 3
Joined: Wed Jun 23, 2010 8:50 am

Re: Ajax File Upload won't Upload!!

Postby ardabeyaz » Wed Jul 21, 2010 7:42 am

Alert the file tmp name when progress is finished. If it's not empty or an error, run an upload script without move_uploaded_file. For example, try filesystem functions for everything is alright. If progress is working correct, then there is no problem with script. There must be a very small thing, you can't see. If you show that part of your code here, i can help you better.
Arda Beyazoğlu - Web Developer
PHPLiveX Core Developer
ardabeyaz
Core Developer
 
Posts: 127
Joined: Thu Sep 27, 2007 6:27 pm
Location: Istanbul


Return to Questions & Answers

Who is online

Users browsing this forum: No registered users and 1 guest