KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using JPEGCAM to allow users to take a profile pic with their web cam. This uploads a temporary file as so: def ajax_photo_upload File.open(upload_path, 'w:ASCII-8BIT') do |f| f.write request.raw_post end # @user.photo = File.open(upload_path) @user.assign_attributes( :photo => File.open(upload_path), :orig_filename => "#{current_user.full_name}.jpg" ) if @user.save respond_to do |format| ..... private def upload_path # is used in upload and create file_name = session[:session_id].to_s + '.jpg' File.join(::Rails.root.to_s, 'public', 'temp', file_name) end What's the best way to go about deleting this temporary file safely? Thanks
Tags (comma-separated)
Save Edits
Cancel