Page 1 of 1

Problem on localhost - swfupload

PostPosted: 18. June 2010 04:26
by cmgmyr
Hey everyone,
I recently got rid of my separate installs for a localhost on my PC (PHP, MySQL, Apache) and went over to xampp for windows. Everything was fine until now when I'm trying to develop a new site with swfupload. I have everything working 100% and it works on the live web server but not on my local machine. For some reason it looks like it's not passing the POST data so the PHP uploading script is failing. Any ideas that I can try out?

Thanks in advance,
-Chris

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 04:37
by Altrea
Why don't you show us your PHP code?
Why don't you give us all the information you have?

Which XAMPP Version do you use?
Which OS do you use?
Do you have changed anything in the configs?

Shall we guess whats happening / went wrong there?

Let's ask my crystal ball...
ehm... my crystal ball says "short_open_tags".

Maybe thats it or maybe not.

Next time try a better describtion of your problem

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 05:01
by cmgmyr
Sure...

PHP - Codeigniter
Code: Select all
public function albums_photos_upload_do()
   {
      $aid = $this->uri->segment(4);
      
      $file_location = $this->config->item('file_url').$this->config->item('assets_dir').$this->config->item('users_dir');
      $config['upload_path'] = $file_location;
      $config['max_size']   = '11264';
      $config['allowed_types'] = $this->config->item('img_types');
      $config['encrypt_name'] = TRUE;
      
      $this->load->library('upload', $config);
   
      if(!$this->upload->do_upload('Filedata'))
      {
         echo $this->upload->display_errors();
      }   
      else
      {         
         $data = $this->upload->data();
         //do other things here
      }
      
      exit(0);
   }


Javascript
Code: Select all
<script type="text/javascript">
   var swfu;
   window.onload = function() {
      var settings = {
         flash_url : "<?=base_url()?>assets/js/swfupload/swfupload.swf",
         upload_url: "<?=base_url().$this->config->item('admin_dir').$this->module?>albums_photos_upload_do/<?=$aid?>",
         file_post_name : "Filedata",
         file_size_limit : "10 MB",
         file_types : "*.jpg;*.gif;*.png",
         file_types_description : "Image Files",
         file_upload_limit : 50,
         custom_settings : {
            progressTarget : "fsUploadProgress",
            cancelButtonId : "btnCancel"
         },
         debug: <?=$debug?>,

         // Button settings
         button_image_url : "<?=base_url()?>assets/js/swfupload/file_upload_icon.jpg",
         button_width : 75,
         button_height : 75,
         button_placeholder_id: "spanButtonPlaceHolder",
         button_text: '',
         
         // The event handler functions are defined in handlers.js
         file_queued_handler : fileQueued,
         file_queue_error_handler : fileQueueError,
         file_dialog_complete_handler : fileDialogComplete,
         upload_start_handler : uploadStart,
         upload_progress_handler : uploadProgress,
         upload_error_handler : uploadError,
         upload_success_handler : uploadSuccess,
         upload_complete_handler : uploadComplete,
         queue_complete_handler : queueComplete   // Queue plugin event
      };
      swfu = new SWFUpload(settings);
    };
</script>


SWFupload debug code
Code: Select all
...
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 47485. Total: 47485
SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_0 Response Received: true Data: <p>You did not select a file to upload.</p>
SWF DEBUG: Event: uploadComplete : Upload cycle complete.


Which XAMPP Version do you use? - 1.7.3
Which OS do you use? - Windows 7 64bit
Do you have changed anything in the configs? - Nothing in Apache - httpd.conf
php.ini:
Code: Select all
short_open_tag = On
error_reporting = E_ALL & ~E_NOTICE
display_errors = off
display_startup_errors = off
extension=php_curl.dll
date.timezone = "America/New_York"

Shall we guess whats happening / went wrong there? - sure, go for it

Let's ask my crystal ball...
ehm... my crystal ball says "short_open_tags". - short_open_tag = On - if it wasn't the application wouldn't run at all

Any other information you need???

Next time try to assume that this is not my first go around with PHP and a server...

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 12:02
by Nobbie
Your PHP Code Snippet is absolutely useless, as you dont show how you retrieve the POST Variables.

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 14:14
by cmgmyr
Sorry, but you are incorrect. In the javascript I have "Filedata" as being the post field name that is being used. In the PHP "if(!$this->upload->do_upload('Filedata'))" uploads that file to the server, but it's throwing an error (shown in the debug output) that the file is not being pushed to the PHP.

As I said before this script is working perfectly on the live server, it's just in xampp that it doesn't work.

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 14:52
by Nobbie
cmgmyr wrote:Sorry, but you are incorrect. In the javascript I have "Filedata" as being the post field name that is being used. In the PHP "if(!$this->upload->do_upload('Filedata'))" uploads that file to the server,


Obviously you have no idea about PHP. "Filedata" is a string, nothing else. It is neither a POST variable, nor a FILE variable.

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 15:06
by cmgmyr
Incorrect again. Obviously you don't have any idea how swfupload works or how Codeigniter works.

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 15:26
by Altrea
cmgmyr wrote:Incorrect again. Obviously you don't have any idea how swfupload works or how Codeigniter works.

Well, obviously you know everything better than us.
So, maybe there are some more infos missing for us, to realise what the problem could be.

How does you know that the POST Data isn't send correct? Just because the SWF Debug Data?
Then, can you proof, which test fails that throws this debug message?

Re: Problem on localhost - swfupload

PostPosted: 18. June 2010 20:26
by JonB
I've always found that showing you are smarter than your would-be helpers ios a very effective tactic.

I was going to post this yesterday, but thought better of it - as wll maybe thngs would work out. I was obviously expecting to much of our friend

:mrgreen: