# upload file routing error

**URL:** <https://discuss.rubyonrails.org/t/upload-file-routing-error/61606>\
**Category:** rubyonrails-talk\
**Created:** [November 14, 2011, 10:54am UTC](https://discuss.rubyonrails.org/t/upload-file-routing-error/61606 "2011-11-14T10:54:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [November 14, 2011, 10:54am UTC](https://discuss.rubyonrails.org/t/upload-file-routing-error/61606/1 "2011-11-14T10:54:17Z")

</div>

Hi

I want to upload file using rails.

I google search find that :

> **[Ruby on Rails - File Uploading](https://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm)**
>
> Ruby on Rails - File Uploading, You may have a requirement in which you want your site visitors to upload a file on your server. Rails makes it very easy to handle this requirement. Now we wil

but it can't not work!

I also modify "\<%= start\_form\_tag" to "\<%= form\_tag" and "\<%= end\_form\_tag %\>" to "\<% end %\>"

It still show error message:

"Routing Error No route matches [POST] "/upload/uploadFile" "

But on routes.rb it included get "upload/uploadFile" and get "upload/index"

How to fix the problem ?

rails version: 3.1.1 OS : Windows XP

Thanks

---

<div class="post-metadata">

**Author:** ![Norbert\_Melzer1](https://avatars.discourse-cdn.com/v4/letter/n/b782af/32.png) [@Norbert\_Melzer1](https://discuss.rubyonrails.org/u/Norbert_Melzer1)\
**Post date:** [November 14, 2011, 11:01am UTC](https://discuss.rubyonrails.org/t/upload-file-routing-error/61606/2 "2011-11-14T11:01:09Z")

</div>

Just a quickshot, but...

It is complaining about a missing POST-route and your routes.rb containes \<get "upload/uploadFile"\>? Do you see it?

HTH Norbert

PS: If you do routes for a filetransfer, never ever use GET, GET is not capable of transferring that much of data, use POST instead. AFAIR thats also written in the HTTP-Standard... PPS: If you don't see it yourself: change \<get "upload/uploadFile"\> to \<post "upload/uploadFile"\>

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [November 14, 2011, 12:23pm UTC](https://discuss.rubyonrails.org/t/upload-file-routing-error/61606/3 "2011-11-14T12:23:08Z")

</div>

> Hi
> 
> I want to upload file using rails.
> 
> I google search find that :[Ruby on Rails - File Uploading](http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm)
> 
> but it can't not work!
> 
> I also modify "\<%= start\_form\_tag" to "\<%= form\_tag" and "\<%= end\_form\_tag %\>" to "\<% end %\>"
> 
> It still show error message:
> 
> "Routing Error No route matches [POST] "/upload/uploadFile" "
> 
> But on routes.rb it included get "upload/uploadFile" and get "upload/index"
> 
> How to fix the problem ?

You're using a really old tutorial, getting on for 5 years old. Routing has changed profoundly in rails since then, in particular if you were adding an uploadFile action, you would need to add a route for that action. I'd strongly suggest you find a more recent tutorial on file uploads.

Fred
