954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Upload Script Help

Hello ,

I would like to modify this script a bit . It is a video upload script for my site . The php content contains all the neccessary fields and upload via browse files only . I would like to make it another optional such as remote/url upload . There have to be 2 optional uploads , whether via browse file or url upload . The php script is below : -

{literal} 
    <script type="text/javascript"> 
    var video_allowed_extensions = /(avi|mpg|mov|asf|mpeg|xvid|divx|3gp|mkv|3gpp|mp4|rmvb|rm|dat|wmv|flv|ogg)$/i;     
    </script> 
    {/literal} 
    <script type="text/javascript" src="{$baseurl}/js/jquery.upload-0.1.php"></script> 
    <div id="content"> 
        {include file="memberside.tpl"} 
         
        <!-- RIGHT --> 
        <div class="right span-653"> 
            <div class="box"> 
                <div class="bsub">&nbsp;</div> 
                <div class="btitle"><h2>{$lang327|upper}</h2></div> 
                <div class="binfo font-12 font-bold"> 
                    {$lang328} 
                </div> 
                 
                <div id="upload_video_form"> 
                <form name="uploadVideo" id="uploadVideo" method="post" enctype="multipart/form-data" target="_self" action="{$baseurl}/upload/video"> 
                 
                    <input type="hidden" name="MAX_FILE_SIZE" value="1048576000" /> 
                    <input type="hidden" name="UPLOAD_IDENTIFIER" id="UPLOAD_IDENTIFIER" value="{$upload_id}" /> 
                    <input type="hidden" name="video_upload_started" /> 
                     
                    <div class="separator"> 
                        <label for="upload_video_title">{$lang329}:</label> 
                        <input name="video_title" type="text" value="" id="upload_video_title" class="large" /> 
                        <span id="video_title_error" class="error" style="display: none;">{$lang330}</span> 
                    </div> 
                     
                    <div class="separator"> 
                        <label for="upload_video_details">{$lang647}:</label> 
                        <textarea name="video_details" id="upload_video_details"></textarea> 
                    </div> 
     
                    <div class="separator"> 
                        <label for="upload_video_keywords">{$lang17}:</label> 
                        <textarea name="video_keywords" id="upload_video_keywords"></textarea> 
                        <span class="expl">{$lang331}</span> 
                        <span id="video_tags_error" class="error" style="display: none;">{$lang332}</span> 
                    </div> 
                     
                    <div class="separator"> 
                        <label for="upload_video_paysite">{$lang333}:</label> 
                        <input name="video_paysite" type="text" value="" id="upload_video_paysite" class="large" /> 
                    </div> 
                     
                    <div class="separator"> 
                        <label for="upload_video_category">{$lang133}:</label> 
                        <select name="video_category" id="upload_video_category"> 
                        <option value="0" selected="selected">-----</option> 
                        {insert name=get_categories assign=cat} 
                        {section name=i loop=$cat} 
                        <option value="{$cat[i].CATID}">{$cat[i].name}</option> 
                        {/section} 
                        </select> 
                        <span id="video_category_error" class="error" style="display: none;">{$lang334}</span> 
                    </div> 
                     
                    <div class="separator"> 
                        <label for="upload_video_file">{$lang142}:</label> 
                        <input name="video_file" type="file" id="upload_video_file" /> 
                        <span id="video_file_error" class="error" style="display: none;">{$lang335}</span> 
                        <span id="video_file_ext_error" class="error" style="display: none;"></span> 
                    </div> 
                     
                     
                     
                    <div class="separator"> 
                        <label for="upload_video_anonymous_no">{$lang135}:</label> 
                        <input name="video_anonymous" type="radio" value="no" id="upload_video_anonymous_no" class="radio" checked="checked" /> 
                        <span class="radio">{$lang136}</span> 
                        <label for="upload_video_anonymous_yes">&nbsp;</label> 
                        <input name="video_anonymous" type="radio" value="yes" id="upload_video_anonymous_yes" class="radio" /> 
                        <span class="radio">{$lang137}</span> 
                    </div> 
                     
                    <div class="separator"> 
                        <label for="upload_video_privacy_public">{$lang336}:</label> 
                        <input name="video_privacy" type="radio" value="public" id="upload_video_privacy_public" class="radio" checked="checked" /> 
                        <span class="radio">{$lang337}</span> 
                        <label for="upload_video_privacy_private">&nbsp;</label> 
                        <input name="video_privacy" type="radio" value="private" id="upload_video_privacy_private" class="radio" /> 
                        <span class="radio">{$lang338}</span> 
                    </div> 
                     
                     
                    <div id="upload_loader" style="display: none;"> 
                        <img src="{$imageurl}/ajax-loader.gif"> 
                    </div> 
     
                    <div id="upload_status" style="display:none;"> 
                        <div id="upload_progress"><div class="bar" style="width: 0;">&nbsp;</div></div> 
                        <div class="upload_info"> 
                            <div id="upload_time"></div> 
                            <div id="upload_size"></div> 
                            <div class="clear"></div> 
                        </div> 
                    </div> 
                    <div id="upload_message" style="display: none;"></div> 
     
                    <div class="separator"> 
                        <label for="upload_video_submit">&nbsp;</label> 
                        <input name="submit_upload_video" type="button" id="upload_video_submit" value="{$lang339}" class="button" /> 
                    </div> 
                </form> 
                </div> 
                 
                <div class="binfo font-12 font-bold"> 
                   {$lang340}          
                </div> 
     
                 
            </div> 
        </div> 
        <!-- RIGHT END --> 
        <!-- rem div here --> 
        <div class="clear"></div> 
    </div>
mrexp21
Newbie Poster
8 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

So let me get this right, you want to upload a video to your site from somebody else's?

And you want somebody here to write the code for you to do that? If so, this a gimme,gimme,gimme post. Please tell me that's not what you're looking for.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Hi ,

I'm actually want to add an extra option to upload video via url . My purpose is to let other users to upload video to my site easily . I just wanted someone that can modify the script a bit to add url upload as 2nd choice only . Anyone willing to help me here...???

mrexp21
Newbie Poster
8 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

I'll give you a pointer:

Many methods to try, including:

cURL
file_get_contents
copy
sockets (fsockopen)

check out the php manual

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Hi ,

Anyway thanks for your concern . But , could you be more specific ?

mrexp21
Newbie Poster
8 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

All those methods will in theory allow you to get a file from a remote server. However, some domain hosts block certain commands, such as file_get_contents().

Here's a curl example:

$ch = curl_init(); 

curl_setopt($ch, CURLOPT_URL, "http://www.targetsite.com/thefile.ext"); 
curl_setopt($ch, CURLOPT_HEADER, false); 
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

set_time_limit(120); //timeout at 2 minutes for php
curl_setopt($ch, CURLOPT_TIMEOUT, 120); // same for curl 

$destinationfile = fopen('/destinationsite.com/thefile.ext', 'wb'); 
curl_setopt($ch, CURLOPT_FILE, $destinationfile); 
curl_exec($ch); 

fclose($destinationfile); 
curl_close($ch);


This may cause your system to hang for a little while, so an ajax operation utilizing an animated 'throbber' may be useful. Otherwise the user may think the form processing has frozen.

Anyway, I'm sure you can find appropriate examples for the others if you Google / use the php manual.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Hi ,

I can find similar codes above and much more better than that . But , I don't know how to insert that code correctly into existing script code . For example , the existing script code requires file browser upload cumpulsory to be filled or I cannot press the submit button . Now , I'm trying make 2 options , whether to use via browser or remote upload . So , I need to remove the compulsory option for file browser upload first . Then , I still need to edit the existing script code as well .

mrexp21
Newbie Poster
8 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

Hi ,

I'm uploaded all my script related with video upload below . Can anyone check it for me whether can do any modifications or not .

Download link :
http://www.mediafire.com/?1th2oa76xxu1ytz

mrexp21
Newbie Poster
8 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

> I can find similar codes above and much more better than that

Sorry, if I'm wasting your time, but you did ask me to elucidate:

> But , could you be more specific

WRT the link, this asks the user to download, unpack and browse. I'm afraid that's going a bit far for a help forum. Bugging out, good luck.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: