Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Andrei  
#1 Posted : Monday, July 11, 2011 5:34:40 AM(UTC)
Andrei

Rank: Newbie

Groups: Member
Joined: 2/26/2011(UTC)
Posts: 6

Thanks: 2 times
I am trying to integrate Aurigma Uploader Express PHP edition but I can't get it to work . After many tries I've made this topic.

This is the `index.php`
http://imageshack.us/pho...ges/695/codepicture.png/
This is the ImageUploaderPHP content .
http://imageshack.us/photo/my-images/4/filesg.png/

I don't get it,where does the error come from ?

Error

http://imageshack.us/pho...-images/405/erroryr.png/

Please help.Any ideas are welcome.
andreym  
#2 Posted : Monday, July 11, 2011 8:50:33 PM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Hi Andrei!

The error in java console means that java can not download ImageUploader7.jar file. By default this file should be in the Scripts folder.
1. Make sure there is ImageUploader7.jar in the Scripts folder.
2. Check that your server allows to download *.jar files.
3. View the html code of the rendered page in the browser and check, that codeBase value has the right path. Something like:
Code:
javaControl: {codeBase: '../ImageUploaderPHP/Scripts/ImageUploader7.jar'}


If previous steps does not help, try to manually set codeBase property in PHP code:
Code:
$uploader->getJavaControl()->setCodeBase("PATH_TO_ImageUploader7.jar_FILE");

Edited by user Monday, July 11, 2011 8:55:55 PM(UTC)  | Reason: Not specified

thanks 1 user thanked andreym for this useful post.
Andrei on 7/11/2011(UTC)
Andrei  
#3 Posted : Tuesday, July 12, 2011 12:47:30 AM(UTC)
Andrei

Rank: Newbie

Groups: Member
Joined: 2/26/2011(UTC)
Posts: 6

Thanks: 2 times
Hmm seems I forgot to add

Code:

$ip = new InstallationProgress($uploader);
$ip->setProgressCssClass("ScreenStyle");
$ip->setInstructionsCssClass("ScreenStyle");


But now It simply displays a text but does nothing,waited few minutes. Also it can't find a picture , maybe that's the problem ?

I've attached several pictures.
Andrei attached the following image(s):
Capture.PNG
Capture2.PNG
Capture3.PNG
andreym  
#4 Posted : Tuesday, July 12, 2011 9:46:33 PM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Hello Andrei!

The Installation Progress is not necessary for Image Uploader, it is just to provide custom splash screen during uploader installation. The default image url is "Scripts/InstallationProgress.gif" related to the page with Image Uploader. Just change ProgressImageUrl property value to where the image is on your web site.

But we still need to find out why java applet does not load. I see, that you set code base as I advice before:
Code:
$uploader->getJavaControl()->setCodeBase("Aurigma/ImageUploaderPHP/Scripts/ImageUploader7.jar");


Does this url work if you paste it in the browser address bar?
Also check the web server logs. Does the server return 200 when browser tries to download ImageUploader7.jar file?

If you can provide me a link to your page with Image Uploader, it will be very helpful. Thanks!
Andrei  
#5 Posted : Tuesday, July 12, 2011 10:21:49 PM(UTC)
Andrei

Rank: Newbie

Groups: Member
Joined: 2/26/2011(UTC)
Posts: 6

Thanks: 2 times
After lots of hours of trying I've made it,but still upload.php will not work.I think I've made it in 3 ways and still does not work.Aurigma Flash Version was basic to setup compared to this.

Issue :
Upload PHP won't upload the files.

Will put all my code here .
Worth to mention :
* I do not use gallery.php I've got a custom made one.
* I try doing this in Zend Framework.
Controller :

Code:

    public function addImageAction(){
        $config = Zend_Registry::get('config');
        $this->view->java_url = $config['url']['base']."Aurigma/ImageUploaderPHP/Scripts/ImageUploader7.jar";
		$product_id = $this->_getParam('prod');
		$this->view->target = $product_id;
		$this->view->prod = $product_id;
    }
    
    function onFileUploaded($uploadedFile) {
      $absGalleryPath = realpath($this->_path) . DIRECTORY_SEPARATOR;   
      $originalFileName = $uploadedFile->getSourceName();
      $files = $uploadedFile->getConvertedFiles();
      // Save source file
      $sourceFile = $files[0];
      /* @var $sourceFile ConvertedFile */
      if ($sourceFile) {
        $sourceFile->moveTo($absGalleryPath . $originalFileName);
      }
    }
    
 	/**
     * 
     * Admin_ProductController::uploadImagesAction()
     * Display Aurigma Uploader.
     */
    public function uploadImagesAction(){
        
        $this->_session->message = $this->_session->messages['message_backend_product_image_notification_succesfully_added'];
        
    	require_once ROOT_PATH . "/Aurigma/ImageUploaderPHP/UploadHandler.class.php";
		require_once ROOT_PATH . "/Aurigma/ImageUploaderPHP/UploadedFile.class.php";

    	$product_id = $this->_getParam('prod');
    	$product = Model_Product::getById($product_id);
        $this->_path = "images/products/".$product['id']."/";
		$uploadHandler = new UploadHandler();
        
        //$uploadHandler->saveFiles(realpath($this->_path));
        
        $uploadHandler->setFileUploadedCallback('onFileUploaded');

        $uploadHandler->processRequest();
    }



And the add-image view.

Code:

<?php
	require_once 'Aurigma/ImageUploaderPHP/Uploader.class.php';
	require_once 'Aurigma/ImageUploaderPHP/InstallationProgress.class.php';
	// Create Image Uploader 
	$uploader = new Uploader('Uploader1');
	$uploader->getJavaControl()->setCodeBase($this->java_url);
	$uploader->setHeight('500px');
	$uploader->setWidth('100%');
	$uploader->setLicenseKey('XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXXX');

	$uploader->setEnableDescriptionEditor(FALSE);
	$uploader->setEnableRotation(FALSE);

    $base = $this->config['url']['base'];
    $uploader->getUploadSettings()->setActionUrl($base."admin/product/upload-images/prod/".$this->prod);
    $uploader->getUploadSettings()->setRedirectUrl($base."admin/product/view/prod/".$this->prod);
    
	$uploader->getUploadSettings()->setFilesPerPackage(1);
    /*
	$converters = $uploader->getConverters();
	// one converter for uploading source file
	$converter = new Converter();
	$converter->setMode("*.*=Source File");
	$converters[] = $converter;
	// and second - for uploading thumbnail
	$converter = new Converter();
	$converter->setMode("*.*=Thumbnail");
	// set thumbnail size
	$converter->setThumbnailWidth(100);
	$converter->setThumbnailHeight(100);
	$converter->setThumbnailFitMode("fit");
	$converters[] = $converter;
    */
	$uploader->getFolderPane()->setHeight(370);
	$uploader->getUploadPane()->setViewMode('List');
	$uploader->getDetailsViewColumns()->setInfoText('');
	$uploader->getPaneItem()->setShowFileNameInThumbnailsView(TRUE);

	$ip = new InstallationProgress($uploader);
	$ip->setProgressImageUrl('images/installation_progress.gif');
	$ip->setProgressCssClass('ip-progress');
	$ip->setInstructionsCssClass('ip-instructions');

	$uploader->render();
?>





Later Edit :
Worth to mention tried making my .htaccess like this and still did not work.

Code:


RewriteEngine On
RewriteCond $1 !^(index\.php|/images|/Aurigma|robots\.txt)
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]



I dumped the upload Handler after setting it in a _session variable . Maybe this will help

Code:
object(__PHP_Incomplete_Class)[51]
  public '__PHP_Incomplete_Class_Name' => string 'UploadHandler' (length=13)
  private '_fileUploadedCallback' (UploadHandler) => string 'onFileUploaded' (length=14)
  private '_allFilesUploadedCallback' (UploadHandler) => null
  private '_destination' (UploadHandler) => string 'C:\wamp\www\online_esb\images\products\1' (length=40)
  private '_cacheAliveTimeout' (UploadHandler) => int 1800
  private '_cacheRoot' (UploadHandler) => string 'C:\Windows\TEMP\uploader_c2215afa418f4cc2bc2c0f92746882f0' (length=57)


Also Added few more rules to the "uploadImagesAction()"

Code:
$this->_helper->layout->disableLayout();
        $this->getHelper('viewRenderer')->setNoRender();



I noticed it doesn't even get to ' function onFileUploaded($uploadedFile)' . Any ideas why ?

Edited by user Tuesday, July 12, 2011 11:51:47 PM(UTC)  | Reason: Not specified

andreym  
#6 Posted : Wednesday, July 13, 2011 12:21:30 AM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Quote:
I noticed it doesn't even get to ' function onFileUploaded($uploadedFile)' . Any ideas why ?


Since all upload code now placed inside controller class onFileUploaded function became class member and not a global function. So callback should be added like this (http://www.php.net/manual/en/language.pseudo-types.php):
Code:
$uploadHandler->setFileUploadedCallback(array($this, 'onFileUploaded'));


Can you please try it and reply if onFileUploaded called now?

Edited by user Wednesday, July 13, 2011 12:23:22 AM(UTC)  | Reason: Not specified

thanks 1 user thanked andreym for this useful post.
Andrei on 7/13/2011(UTC)
Andrei  
#7 Posted : Wednesday, July 13, 2011 12:36:58 AM(UTC)
Andrei

Rank: Newbie

Groups: Member
Joined: 2/26/2011(UTC)
Posts: 6

Thanks: 2 times
Done. Noticed the $uploadHandler changed a bit,but It still won't upload.

Code:

object(__PHP_Incomplete_Class)[51]
  public '__PHP_Incomplete_Class_Name' => string 'UploadHandler' (length=13)
  private '_fileUploadedCallback' (UploadHandler) => 
    array
      0 => 
        object(Admin_ProductController)[50]
          protected '_session' => 
            object(Zend_Session_Namespace)[64]
              ...
          protected '_path' => string 'images/products/1/' (length=18)
          protected '_classMethods' => 
            array
              ...
          protected '_delimiters' => null
          protected '_invokeArgs' => 
            array
              ...
          protected '_frontController' => null
          protected '_request' => 
            object(Zend_Controller_Request_Http)[88]
              ...
          protected '_response' => 
            object(Zend_Controller_Response_Http)[83]
              ...
          public 'viewSuffix' => string 'phtml' (length=5)
          public 'view' => 
            object(Zend_View)[71]
              ...
          protected '_helper' => 
            object(Zend_Controller_Action_HelperBroker)[106]
              ...
      1 => string 'onFileUploaded' (length=14)
  private '_allFilesUploadedCallback' (UploadHandler) => null
  private '_destination' (UploadHandler) => null
  private '_cacheAliveTimeout' (UploadHandler) => int 1800
  private '_cacheRoot' (UploadHandler) => string 'C:\Windows\TEMP\uploader_c2215afa418f4cc2bc2c0f92746882f0' (length=57)




Good News is . The onFileUpload is accesed :) Thanks . But still the file doesn't seem to be moved from temp to the directory .

string 'C:\wamp\www\online_esb\images\products\1\' (length=41)

This is the $absGalleryPath.
andreym  
#8 Posted : Wednesday, July 13, 2011 12:42:04 AM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Andrei wrote:
Good News is . The onFileUpload is accesed :) Thanks . But still the file doesn't seem to be moved from temp to the directory .
string 'C:\wamp\www\online_esb\images\products\1\' (length=41)
This is the $absGalleryPath.


Does the directory $absGalleryPath exists and has write permissions?
Check php error log. Usually there is useful information here when the php code does not work as expected :)
Andrei  
#9 Posted : Wednesday, July 13, 2011 12:58:33 AM(UTC)
Andrei

Rank: Newbie

Groups: Member
Joined: 2/26/2011(UTC)
Posts: 6

Thanks: 2 times
Gave write permission but still It does not work . The error I get :

Code:

[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP Notice:  Undefined offset: 0 in C:\\wamp\\www\\online_esb\\application\\modules\\admin\\controllers\\ProductController.php on line 531, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   1. {main}() C:\\wamp\\www\\online_esb\\index.php:0, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   2. Zend_Application->run() C:\\wamp\\www\\online_esb\\index.php:31, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   3. Zend_Application_Bootstrap_Bootstrap->run() C:\\wamp\\www\\library\\Zend\\Application.php:366, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   4. Zend_Controller_Front->dispatch() C:\\wamp\\www\\library\\Zend\\Application\\Bootstrap\\Bootstrap.php:97, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   5. Zend_Controller_Dispatcher_Standard->dispatch() C:\\wamp\\www\\library\\Zend\\Controller\\Front.php:954, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   6. Zend_Controller_Action->dispatch() C:\\wamp\\www\\library\\Zend\\Controller\\Dispatcher\\Standard.php:295, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   7. Admin_ProductController->uploadImagesAction() C:\\wamp\\www\\library\\Zend\\Controller\\Action.php:513, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   8. UploadHandler->processRequest() C:\\wamp\\www\\online_esb\\application\\modules\\admin\\controllers\\ProductController.php:558, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP   9. UploadSession->processRequest() C:\\wamp\\www\\online_esb\\Aurigma\\ImageUploaderPHP\\UploadHandler.class.php:137, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP  10. call_user_func() C:\\wamp\\www\\online_esb\\Aurigma\\ImageUploaderPHP\\UploadSession.class.php:49, referer: http://localhost/online_esb/admin/product/add-image/prod/1
[Wed Jul 13 11:46:09 2011] [error] [client 127.0.0.1] PHP  11. Admin_ProductController->onFileUploaded() C:\\wamp\\www\\online_esb\\Aurigma\\ImageUploaderPHP\\UploadSession.class.php:0, referer: http://localhost/online_esb/admin/product/add-image/prod/1



I dumped $files and I got empty.
$files = $uploadedFile->getConvertedFiles();

I `un commented` the converters,they look like this :

Code:
	
        $converters = $uploader->getConverters();
	// one converter for uploading source file
	$converter = new Converter();
	$converter->setMode("*.*=Source File");
	$converters[] = $converter;
	// and second - for uploading thumbnail
	$converter = new Converter();
	$converter->setMode("*.*=Thumbnail");
	// set thumbnail size
	$converter->setThumbnailWidth(100);
	$converter->setThumbnailHeight(100);
	$converter->setThumbnailFitMode("fit");
	$converters[] = $converter;
andreym  
#10 Posted : Wednesday, July 13, 2011 1:11:38 AM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
I think it is because you miss &:
Code:
$converters = $uploader->getConverters();

should be
Code:
$converters = &$uploader->getConverters();


Try to dump $uploader->getConverters(); after you configure converters.

Hope it will help.
Andrei  
#11 Posted : Wednesday, July 13, 2011 1:24:21 AM(UTC)
Andrei

Rank: Newbie

Groups: Member
Joined: 2/26/2011(UTC)
Posts: 6

Thanks: 2 times
Thank you very much.I don't know how to thank you enough for your great support and help.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.