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 6212849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:35:27+00:00 2026-05-24T06:35:27+00:00

I’m trying to submit a user uploaded video to youtube using an html input

  • 0

I’m trying to submit a user uploaded video to youtube using an html input type file and the python module youtube-upload. When the form is submitted it is handled like so:

if request.method == 'POST':
    video = request.FILES['file']

    v=str(video)

    command = 'youtube-upload --email=email@gmail.com --password=password --title=title --description=description --category=Sports ' + v

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

So I would assume the problem is that I need to provide a more complete path for the video. If this is the case, what is the path to access the video in temporary memory.

The generic for of the command is:
youtube-upload --email=email --password=password --title=title --description=description --category=category video.avi

Alternatively, I’ve looked at the youtube api specifically here but if anyone could provide a more complete explanation of how to do this in python using the api that would be amazing. Unfortunately, the guide on the site just focuses on the xml.

EDIT FOLLOWING sacabuche’s COMMENT:

so my view is now roughly:

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() ) )

but v=video.temporary_file_path draws the error 'InMemoryUploadedFile' object has no attribute 'temporary_file_path'. So video is still in temporary memory and I don’t know what object temporary_file_path is suppose to be called on or how to get said object.

  • 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-24T06:35:27+00:00Added an answer on May 24, 2026 at 6:35 am

    In fact django save the files on memory, but large files are saved in a path.
    The size of "large file" can be defined in settings using FILE_UPLOAD_MAX_MEMORY_SIZE
    and
    The FILE_UPLOAD_HANDLERS by default are:

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

    And this give us 2 possibilities:

    1. Remove the memory handler

    Remove the ..MemoryFileUploadHandler but all your files will be saved in a temp file and this is not cool

    2. Modify the handlers on the fly

    docs here

    #views.py
    
    def video_upload(request):
        # this removes the first handler (MemoryFile....)
        request.upload_handlers.pop(0)
        return _video_upload(request)
    
    def _video_upload(request):
        ....
    

    To get the file path you just need to do video.temporary_file_path

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I need to clean up various Word 'smart' characters in user input, including but
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.