courses
Image

DataFlair Team

The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.

19 Responses

  1. Image Abdulla says:

    Nice exercise …

    When i tried to upload pdf file ” hello, you have uploaded the wrong file type.”

    but when tried to upload image file give Server Error (500)

    • Image Karan Mittal says:

      This implies that the image file is not handled correctly at the server-side. please check if you have installed the packages like Pillow for this purpose.

  2. Image DataFlair Team says:

    Hey Abdulla,

    It seems like you haven’t installed PILLOW library of Python. Install that in your virtual environent and try running that again.

  3. Image Leena says:

    Not showing the uploaded file

  4. Image Ig says:

    Hi! May I use this method to upload file after my projet was deployed to server?

    • Image Karan Mittal says:

      You can use this method if your server is static, But I would recommend that you properly create your models and save only one file per user because its quite easy to run out of space for this. also, If you are looking for scaling, you should use a combination of databases for storing and retrieving your files.

  5. Image Joe Wilson says:

    Where is STATIC_URL and STATIC_ROOT in settings.py in project dir in this example?

    • Image PhiWue says:

      @Data-Flair Team:
      You probably made a mistake in your order. If you follow the learn-django tutorial the section “6. Django File Upload” comes before “7. Django Static File Handling”

      Therefore we can’t know that STATIC_URL and STATIC_ROOT will be set in the next Tutorial. So maybe you should just switch order.
      I was already confused in the beginning where you talked about a previous tutorial which I couldn’t remember till I figured out it will be the next one.

  6. Image Ranjeet says:

    i am not able to view image in django/admin interface
    it says:- doesn’t exist. Perhaps it was deleted?
    but image is present in media folder

  7. Image IK says:

    Hello
    Newbie here. Tried the upload code but no file seems to be going into my media directory and can’t tell what the issue is.
    I have checked the media path over and over again & it looks ok.
    Any advise please?

  8. Image Riyaz Pathan says:

    can we upload pdf or doc file

  9. Image PB says:

    Hello , Newbie here
    I successfully follow all steps, when I upload file it appears in media folder but error comes with

    OperationalError at /upload/
    no such table: profile_maker_user_profile
    Request Method: POST
    Request URL: http : // 127.0.0.1 : 8000 /upload/
    Django Version: 4.0
    Exception Type: OperationalError
    Exception Value:
    no such table: profile_maker_user_profile
    Exception Location: E:\PritiBhatt\Audio-server\venv\lib\site-packages\django\db\backends\sqlite3\base.py, line 416, in execute
    Python Executable: E:\PritiBhatt\Audio-server\venv\Scripts\python.exe
    Python Version: 3.9.0
    Python Path:
    [‘E:\\PritiBhatt\\Audio-server\\audio_server’,
    ‘c:\\users\\ac\\appdata\\local\\programs\\python\\python39\\python39.zip’,
    ‘c:\\users\\ac\\appdata\\local\\programs\\python\\python39\\DLLs’,
    ‘c:\\users\\ac\\appdata\\local\\programs\\python\\python39\\lib’,
    ‘c:\\users\\ac\\appdata\\local\\programs\\python\\python39’,
    ‘E:\\PritiBhatt\\Audio-server\\venv’,
    ‘E:\\PritiBhatt\\Audio-server\\venv\\lib\\site-packages’]
    Server time: Wed, 05 Jan 2022 22:26:35 +0000

    any recommendation where I am wrong?

    Thank you in advance.

  10. Image Frank Valen says:

    why is there upload in this path instead of profile_maker
    (‘upload/’, include(‘profile_maker.urls’)),
    from django.contrib import admin
    from django.urls import path, include

    urlpatterns = [
    path(‘admin/’, admin.site.urls),
    path(‘upload/’, include(‘profile_maker.urls’)),
    ]

Leave a Reply

Your email address will not be published. Required fields are marked *