Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6224545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:41:30+00:00 2026-05-24T08:41:30+00:00

Possible Duplicate: Problem accessing user uploaded video in temporary memory So I’ve tried this

  • 0

Possible Duplicate:
Problem accessing user uploaded video in temporary memory

So I’ve tried this question here and here but I might have been being too specific or misguided in my question.

Essentially I am trying to take a video submitted via <form> <input type='file'/> </form> and submit it to youtube.

I’ve looked at youtube direct, but it is a nightmare to setup and doesn’t really provide the functionality I’m looking for. I’ve looked at the youtube data api but as stated in the previous question the docs are somewhat lacking in specificity regarding implementation in python.

If anyone could walk me through this or point me in the direction of a great tutorial I would be forever grateful.

My previous questions pretty well outline what I am currently trying but here it is for quick reference:

html:

<form method='post' action='/new/' enctype="multi-part/form-data">{% csrf_token %}
<input type='file' name='file' id='file'/>
<input type='submit' />
</form> 

django view (youtube-upload is a python module that uses the youtube data api to upload a file to youtube using the information specified):

 def upload_video(request):
     if request.method == 'POST':
         video = request.FILE['file']
         v = video.temporary_file_path
         command = 'youtube-upload --email=email@gmail.com --password=password --title=title --description=description --category=Sports ' + v   

         r=subprocess.Popen(command, stdout=subprocess.PIPE)

         vid = r.stdout.read()
     else:
         form = VideoForm()
         request.upload_handlers.pop(0)
     return render_to_response('create_check.html', RequestContext(request, locals() ) )

currently v=video.temporary_file_path draws the error 'InMemoryUploadedFile' object has no attribute 'temporary_file_path'.

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:41:30+00:00Added an answer on May 24, 2026 at 8:41 am

    Your current problem is that your file hasn’t been saved to disk, so how could it have a path?

    There are two obvious solutions. First, you can change your FILE_UPLOAD_HANDLERS setting to have only one handler, like so:

    ("django.core.files.uploadhandler.TemporaryFileUploadHandler",)
    

    so it will automatically save all files to disk.

    Second, you could save the file manually by doing

    with open('some/file/name', 'wb+') as destination:
        for chunk in video.chunks():
            destination.write(chunk)
    

    and then just pass some/file/name in the arguments to youtube_upload.main_upload.

    If you had read the Django Docs which answers to both of your first two questions pointed you to, you would know this.

    The source of Youtube Upload makes it clear it can certainly be imported. Simply import youtube_upload with it in your path and then call it with youtube_upload.main_upload(arguments, output) where arguments is

    ['--email=email@gmail.com', '--password=password', '--title=title', '--description=description', '--category=Sports', 'path/to/file']
    

    The output option defaults to sys.stdout, you can redirect it if you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Need help solving Project Euler problem 200 Similar to this question Project
Possible Duplicate: Dumb 8 Queens problem in C++ Hi I came over this question
Possible Duplicate: Help with algorithm problem from SPOJ Came across this interview question. Given
Possible Duplicate: problem with template inheritance This code doesn't compile in GCC: template <typename
Possible Duplicate: Problem with Macros Hi all I have defined this macro: #define SQ(a)
Possible Duplicate: problem in comparing double values in C# I've read it elsewhere, but
Possible Duplicate: Android AdMobs problem. I am trying to put in an ad but
Possible Duplicate: Please tell me about this XNA development problem on DELL inspiron !
Possible Duplicate: How to write program during compiling? I found this problem on a
Possible Duplicate: Problem with simpleXML and entity not being defined I have this tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.