Why are you reading one file and then writing it to another?

Why don't you just copy it? http://is.gd/gNve

And if file operations doesn't work, open up console and try it there.
You will see if it was successful, because irb will show true/false.
If it's false, then check if your directories have rights to be
writed.

On 22. Jan, 05:46 h., dare ruby <[email protected]>
wrote:
> Dear all,
>
> I have uploaded gif images and stored in folder called banner list. I
> have successfully read and written the uploaded gif files even animated
> gif files. But when i read the same gif file from the the bannerlist
> folder and write in banner folder, i was not able to do so. Please
> suggest on how to read gif images from a folder and write in another
> folder.
>
> I have used code :
>
> if File.exists? RAILS_ROOT + "/public/images/bannerlist/#{params[:id]}"
>
>   a = File.read("public/images/bannerlist/martin2.gif")
>
>   File.open("public/images/banner/" + "banner.gif" , "wb") do |f|
>
>       f.write(a)
>
>   end
> end
>
> For Uploading of images i have used following code and it works fine, so
> please suggest on the above issue of reading and writing of animated gif
> files from one folder to another.
>
> image = params[:image][:blob]
>
> image1=params[:image][:blob].original_filename
>
> File.open(RAILS_ROOT + "/public/images/bannerlist/" + image1, "wb") do
> |f|
>
>   f.write(params[:image][:blob].read)
>
> end
>
> please suggest a way for reading and writing of animated gif files from
> one folder to another.
>
> Thanks in advance
>
> Regards,
> Jose
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to