I am using file uploading in my ruby on rails application. And when the file is uploaded, I want to make the link for others so that they can also download that file. I have a folder named job_attachments within the assets folder for the file attachments. I want to know how I can get the the path for job_attachments using jQuery.
I am doing something like this in my controller:
def uploadattachment
if(params[:job][:uploaded_data])
uploaded_io=params[:job][:uploaded_data]
File.open(Rails.root.join('app/assets', 'job_attachments', uploaded_io.original_filename), 'wb') do |f|
f.write(uploaded_io.read)
end
respond_to do |format|
format.json {render :layout=>false , :json => uploaded_io.original_filename}
end
end
end