From: Tulsi Das Date: 2006-11-27T23:48:33+09:00 Subject: Appending to file in arbitrary position Hi, I'm implementing the server side of a file upload with resume option part of a web app. The client sends the last position so I have to append to the existing file from that position. Current code is: @uploadfile = @params["uploadfile"] content_range = @request.env['HTTP_CONTENT_RANGE'] filename = @uploadfile.original_filename data = @uploadfile.read # position to append from pos = content_range[/\d+/].to_i f = File.open("#{filename}", "a") #f.pos = pos f.seek(pos) f.write(data) f.close I've tried opening the file with a and a+ modes. I've tried doing rewing, setting pos (like the commented line) and seek, and none of them works, the new data is always appended at the end of the file. Any clues? Thanks -- Posted via http://www.ruby-forum.com/.