Did you found any solution?

Because I have the same problem, but on opposite side (works on mac
but not on linux).

I think that you need a trailing "/" to your upload_to path though.

Francis


On Mar 1, 8:21 pm, tom <thomas.st...@gmail.com> wrote:
> here is some more information, maybe that helps. These are just
> different lines of code from different files, but they actually
> describe what's happening:
>
> settings.py
> MEDIA_ROOT = '/Library/WebServer/Documents/media/indiebreed/'
>
> models.py
> file = models.FileField(upload_to="tmp/tracks", max_length = 1000)
>
> json_views.py
>     if request.method == 'POST':
>         form = TrackForm(request.POST, request.FILES)
>         if form.is_valid():
>             new_track = form.save(commit = False)
>             print new_track.file.path
>
> error:
> IOError at /music/tracks/testupload/
> [Errno 2] No such file or directory: u'/Library/WebServer/Documents/
> media/indiebreed/03 Magical Box.mp3'
>
> actually the path should be like this:
> /Library/WebServer/Documents/media/indiebreed/tmp/tracks/03 Magical
> Box.mp3
>
> any ideas?
> ah, i am on a mac and it works under linux
>
> many thanks.
> tom
>
> Path: .
> URL:http://code.djangoproject.com/svn/django/trunk
> Repository Root:http://code.djangoproject.com/svn
> Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37
> Revision: 9912
> Node Kind: directory
> Schedule: normal
> Last Changed Author: russellm
> Last Changed Rev: 9911
> Last Changed Date: 2009-02-27 14:14:59 +0100 (Fr, 27 Feb 2009)
> On 28 Feb., 01:47, tom <thomas.st...@gmail.com> wrote:
>
> > Hi,
>
> > I am somehow confused. I am using this in a model:
> > file = models.FileField(upload_to="tmp/tracks/", max_length = 1000)
>
> > and than I am doing this in a form:
> > new_track = form.save(commit = False)
>
> > after that I want to access the file to do some stuff with it, like
> > print new_track.file.path
>
> > when I do this, the path to the file is without the extra path from
> > "upload_to" in the model. how can I access the full path to the file?
> > Or, where will the file be saved to, because it also does not exist
> > within the "upload_to" dir.
>
> > Maybe it would be a solution to access the temp file, does someone
> > know how to access the path string?
>
> > regards, tom
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to