Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7447125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:30:55+00:00 2026-05-29T12:30:55+00:00

I want to upload a text file received via AJAX request in Symfony2 (using

  • 0

I want to upload a text file received via AJAX request in Symfony2 (using Uploadify 2.1.4). How can I process it in an action? I’ve found some info in the official docs, but I guess it is not what I’m looking for.

For instance, I processed such a situation in Zend Framework this way:

    $adapter = new Zend_File_Transfer_Adapter_Http();
    $adapter->setFilters(array(
        'Rename' => array(
            'target'    => sprintf('%s/%d_%s', Zend_Registry::get('config')->uploads->uploadPath, time(), $adapter->getFileName(null, false), 'UTF-8'),
            'overwrite' => true,
        ),
    ));
    try
    {
        $adapter->receive();
    }
    catch (Zend_File_Transfer_Exception $e)
    {
        throw new Zend_Controller_Action_Exception(sprintf('Bad file: %s', $e->getMessage()));
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:30:56+00:00Added an answer on May 29, 2026 at 12:30 pm

    I found the following simple solution. Maybe it’ll be of help to somebody. 😉

    The frontend part:

      $('#upload-file').uploadify(
        {
            script:         '/upload-file',
            folder:         '/uploads',
            method:         'POST',
            uploader:       '/bundles/mybundle/flash/uploadify.swf',
            cancelImg:      '/bundles/mybundle/images/cancel.png',
            buttonImg:      '/bundles/mybundle/images/upload.png',
            width:          48,
            height:         48,
            auto:           false,
            queueID:        'fileQueue',
            wmode:          'transparent',
            fileDataName:   'uploaded_file',
            fileDesc:       'Text File (*.txt)',
            fileExt:        '*.txt',
            sizeLimit:      8000000,
            multi:          true,
            simUploadLimit: 3,
            onError:        function (event, id, fileObj, errorObj)
            {
                console.log(errorObj.type + ' Error: ' + errorObj.info);
            }
        });
    

    The backend part:

    public function uploadFileAction()
    {
        $request = $this->getRequest();
        $destination = preg_replace('/app$/si', 'web' . $request->request->get('folder'), $this->get('kernel')->getRootDir());
        $uploadedFile = $request->files->get('uploaded_file');
    
        $uploadedFile->move($destination, $uploadedFile->getClientOriginalName());
    
        return new Response(1);
    }
    

    The issue is closed!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload a file using an ajax request var xhr = new
Want to upload a file using ajax for this using this uploader http://valums.com/ajax-upload/ and
I want to upload and then process a file in a Ruby on Rails
In my site I want to upload a zipped folder using ajax. Code: <script
I want to use progress bar to show file upload progress. I'm currently using
I'm using Paperclip / S3 for file uploading. I upload text-like files (not .txt,
I'm using the script from http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/ I modified the onComplete to add a link
i want to import .txt file values into mysql using php and jquery/Ajax without
i want to upload the sound file (.ogg) in server. But it should write
I want to upload and store video files to my server using PHP. Could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.