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

  • Home
  • SEARCH
  • 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 7655417
In Process

The Archive Base Latest Questions

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

I am uploading images using sfWidgetFormInputFile() to the folder MY_PROJECT/WEB/UPLOADS .How to download those

  • 0

I am uploading images using sfWidgetFormInputFile() to the folder MY_PROJECT/WEB/UPLOADS .How to download those files from that path. how to get the path for the uploads folder. And also when i upload a file the file name changes to somthing like this 1f3c6d9bf7b8ebda8b600576c55817c34715a8421.How can i upload with its orginal name? thanks in advance.

  • 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-31T12:30:41+00:00Added an answer on May 31, 2026 at 12:30 pm

    There is an easier way… put a generateFieldNameFilename() function into your model or form class (where FieldName is the camelized name of the field where you store the image).

    // your form or model class
    public function generateImageFilename(sfValidatedFile $file)
    {
      return $file->getOriginalName();
    }
    
    // in your template ($model => model object)
    <?php echo link_to($model->getImage(), '/uploads/'.$model->getImage(), array('target' => '_blank')); ?>
    // to dispaly the image in the link
    <?php echo link_to(image_tag('/uploads/'.$model->getImage()), '/uploads/'.$model->getImage(), array('target' => '_blank')); ?>
    

    This will open your image in a new tab. If you would like to force download images in your uploads dir put a .htaccess file into it (headers module must be enabled sudo a2enmod headers):

    SetEnvIf Request_URI "\.jpg$" requested_jpg=jpg
    Header add Content-Disposition "attachment" env=requested_jpg
    

    By the way symfony renames your uploaded files because filenames must be unique in a directory so if you want to keep the original name, the field where you store the filename should be unique and every model should have a separate subdirectory for its files.

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

Sidebar

Related Questions

Am using FbGraph and SBJSON files for uploading images on facebook from iphone. A
I am uploading some images using plupload and adding those images to div container.And
I am uploading images to S3 storage using paperclip gem. It uploads successfully. In
I am using MIME multipart for uploading images to server. Sometime image get distorted.
I am uploading images from an iPhone to my server. The code that I'm
I'm using paperclip for uploading files, handling images is easy, but how can I
I am using PHP/MySQL to handle the image uploading. I want all images that
How can I add the ability of uploading multiple images for a product from
I uploading the images using connect-form and express as in https://github.com/visionmedia/express/blob/cbdd907393e6fc9cf4eb092237241d1626a9a98d/examples/multipart/app.js . The images
Looking at using either ObjectiveResource or ASIHTTPRequest ... Which is superior for uploading images?

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.