Flashupload not automatic

Any hacks and modifications will be in here...

Flashupload not automatic

Postby numix » Fri Jun 03, 2011 1:41 pm

Hey i don't like it if the script uploads the images automatic after file selection.
What do i have to change to stop the automatic upload? It would be cool if the user gets a table with the selected images and perhaps with a cross to delete the picture from the list.
numix
Standard Member
 
Posts: 12
Joined: Sun May 15, 2011 7:35 pm

Re: Flashupload not automatic

Postby PeterS » Fri Jun 03, 2011 2:12 pm

numix wrote:Hey i don't like it if the script uploads the images automatic after file selection.
What do i have to change to stop the automatic upload? It would be cool if the user gets a table with the selected images and perhaps with a cross to delete the picture from the list.


You'll have to tweak SWFUpload in order to prevent auto-uploads.

Example: 1. Remove startupload(); 2. Add a button or image to call the function startupload();
PeterS
Global Moderator
 
Posts: 159
Joined: Mon Feb 21, 2011 4:58 am

Re: Flashupload not automatic

Postby numix » Mon Jun 06, 2011 11:17 am

Hm i can'tz modify this, can you helf me an give me the new code?
numix
Standard Member
 
Posts: 12
Joined: Sun May 15, 2011 7:35 pm

Re: Flashupload not automatic

Postby SamEA » Tue Jun 07, 2011 1:21 am

numix wrote:Hm i can'tz modify this, can you helf me an give me the new code?


This is a good example of how, the startupload() function can be called.

Replace ./styles/Indigo/file_upload_form.php with this file
Code: Select all
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/jquery.swfupload.js"></script>
<script type="text/javascript">
var swfu;
$(function(){
   $('#swfupload-control').swfupload({
      upload_url: "upload.php?do=verify&method=flash",
      file_post_name: 'upfile',
      file_size_limit : "<? echo ($maxfilesize * 1024); ?>",
      file_types : "<? echo $file_types; ?>",
      file_types_description : "File Types",
      file_upload_limit : 5,
      flash_url : "js/swfupload/swfupload.swf",
      button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png',
      button_width : 114,
      button_height : 29,
      button_placeholder : $('#button')[0],
      debug: false
   })
      .bind('fileQueued', function(event, file){
         var listitem='<li id="'+file.id+'" >'+
            'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
            '<div class="progressbar" ><div class="progress" ></div></div>'+
            '<p class="status" >Pending</p>'+
            '<span class="cancel" > </span>'+
            '</li>';
         $('#log').append(listitem);
         $('li#'+file.id+' .cancel').bind('click', function(){
            var swfu = $.swfupload.getInstance('#swfupload-control');
            swfu.cancelUpload(file.id);
            $('li#'+file.id).slideUp('fast');
         });
         // start the upload since it's queued
   // Here are some POST values to send. Thes
            var swfu = $.swfupload.getInstance('#swfupload-control');
swfu.addPostParam("myemail", $("input#myemail").val());
swfu.addPostParam("descr", $("input#descr").val());
swfu.addPostParam("pprotect", $("input#pprotect").val());
swfu.addPostParam("usercheck", $("input#usercheck").val());
swfu.addPostParam("passcheck", $("input#passcheck").val());
      })
      .bind('fileQueueError', function(event, file, errorCode, message){
         alert('Size of the file '+file.name+' is greater than limit');
      })
      .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
         $('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);
      })
      .bind('uploadStart', function(event, file){
         $('#log li#'+file.id).find('p.status').text('Uploading...');
         $('#log li#'+file.id).find('span.progressvalue').text('0%');
         $('#log li#'+file.id).find('span.cancel').hide();
      })
      .bind('uploadProgress', function(event, file, bytesLoaded){
         //Show Progress
         var percentage=Math.round((bytesLoaded/file.size)*100);
         $('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
         $('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
      })
      .bind('uploadSuccess', function(event, file, serverData){
         
         var item=$('#log li#'+file.id);
         item.find('div.progress').css('width', '100%');
         item.find('span.progressvalue').text('100%');
         var pathtofile='<a href="/'+file.name+'" target="_blank" >view &raquo;</a>';
         item.addClass('success').find('p.status').html('Completed!!! | '+serverData);


      })
      .bind('uploadComplete', function(event, file){
         // upload has completed, try the next one in the queue
         $(this).swfupload('startUpload');
      })
   
});   

   $(document).ready(function(){          
      $('#show_upload_button').hide();                 
      $('a').click(function(){                    
      $('#show_upload_button').toggle('slow');     
                    });
      $('#show_upload_form').hide();                 
      $('a').click(function(){                    
      $('#show_upload_form').toggle('slow');    
      $('#swfupload-control').toggle('slow');    
      })         
   
      $('a#close').click(function(){          
      $('#show_upload_button').hide('slow');       
      })         
                  });
</script>
<script type="text/javascript">
function CancelUpload() {
  alert("Cancel Upload now");
    if (confirm("Are you sure to cancel Upload now?")) {
      window.location = "index.php";
    }
    else
      alert("Upload Resumed."); {
    }
}
</script>
<SCRIPT language="JavaScript">
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}
</script>
<script type="text/javascript"><!--
var W3CDOM = (document.createElement && document.getElementsByTagName);
function initFileUploads() {
   if (!W3CDOM) return;
   var fakeFileUpload = document.createElement('div');
   fakeFileUpload.className = 'fakefile';
   fakeFileUpload.appendChild(document.createElement('input'));
   var image = document.createElement('img');
   image.src='button_select.gif';
   fakeFileUpload.appendChild(image);
   var x = document.getElementsByTagName('input');
   for (var i=0;i<x.length;i++) {
      if (x[i].type != 'file') continue;
      if (x[i].parentNode.className != 'fileinputs') continue;
      x[i].className = 'file hidden';
      var clone = fakeFileUpload.cloneNode(true);
      x[i].parentNode.appendChild(clone);
      x[i].relatedElement = clone.getElementsByTagName('input')[0];
      x[i].onchange = x[i].onmouseout = function () {
         this.relatedElement.value = this.value;
      }
   }
}
function uploadnow()
{
   alert("Your Upload has started...");
$('#swfupload-control').swfupload('startUpload');
         
}
//--></script>

<!-- flooble Expandable Content header start -->
<script language="javascript">
// Expandable content script from flooble.com.
// For more information please visit:
//   http://www.flooble.com/scripts/expand.php
// Copyright 2002 Animus Pactum Consulting Inc.
//----------------------------------------------
var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId);
 if (lText == '+') { link.innerHTML = '-'; d.style.display = 'block'; }
 else { link.innerHTML = '+'; d.style.display = 'none'; } }
</script>
<!-- flooble Expandable Content header end   -->
</head>
     <? include("./ads.php"); ?>
<p><center><? echo $lang[info];?></center></p>

<h1><center><? echo $lang[upload];?></center></h1>
   <center>
<?php
if ($_GET['error'] == "nofile"){
?>
<div class="error"><img src="./img/error.png"><?php echo $lang[dpick]; ?></div><p>
<?php
}elseif ($_GET['error'] == "invalid_filetype"){
?>
<div class="error"><img src="./img/error.png"><?php echo $lang[itype]; ?></div><p>
<?
}elseif ($_GET['error'] == "too_large"){
?>
<div class="error"><img src="./img/error.png"><?php echo $lang[tlarge]; ?></div><p>
<?
}elseif ($_GET['error'] == ""){
?>
<div class="notices"><img src="./img/note.png"><?php echo $lang[multiupload]; ?></div><p>
<?
}
?>
<div id="clickme">
  <a href="#">Flash/HTML Form</a>
</div><p>
   <ol id="log"><input type="button" value = "Upload Now!" onclick="uploadnow()" /></ol>
   <form enctype="multipart/form-data" action="upload.php?do=verify" id="form" method="post" onsubmit="a=document.getElementById('form').style;a.display='none';b=document.getElementById('part2').style;b.display='inline';" style="display: inline;">
<? echo $lang[maxsize];?> <b><?php echo $maxfilesize; ?> MB</b><br />
<?php
if ($file_types <> "*"){
?>
Allowed file types: <b><?php echo $file_types;?></b><p>
<?
}
?>
         <table border=0 cellspacing=0 cellpadding=2><tr><td align=center colspan=2>
   <?php echo $filetypes; ?>
   <div id="show_upload_form"><img src="img/bild.gif"> <input type="file" name="upfile" size="50" /></div></td></tr>
         <tr><td align=left>
   <?php if($emailoption) { ?><? echo $lang[emailopt];?>:</td><td align=right><input type="text" name="myemail" id="myemail" size="40" /> <i>(<? echo $lang[opt];?>)</i></td></tr><?php } ?>
   <tr><td align=left><?php if($descriptionoption) { ?><? echo $lang[desopt];?>:</td><td align=right><input type="text" name="descr" id="descr" size="40" /> <i>(<? echo $lang[opt];?>)</i></td></tr><?php } ?>
   <tr><td align=left><?php if($passwordoption) { ?><? echo $lang[passopt];?>:</td><td align=right><input type="text" name="pprotect" id ="pprotect" size="40" /> <i>(<? echo $lang[opt];?>)</i></td></tr><?php } ?>
         <tr><td align=center colspan=2><?php if(isset($categorylist)) { echo $categorylist; } ?></td></tr></table>
   <?php
   if (isset($_SESSION['user'])) {
      emailcheck();
      if($content[5] == "true" || $_SESSION['emailactcheck'] == "ok" || $_SESSION['user'] == "admin"){
      $_SESSION['emailactcheck'] = "ok";
      ?>
   <input type="hidden" name="usercheck" value = "<?php echo $_SESSION['user'];?>" id ="usercheck" size="40" />
   <input type="hidden" name="passcheck" value = "<?php echo $_SESSION['pass'];?>" id ="passcheck" size="40" />
      <?php
      }
   }
   ?>
<div id="show_upload_button"><center><input type="submit" value="Upload!" id="upload" /></center><p></div>
<div id="swfupload-control">
   <input type="button" id="button" />
   <p id="queuestatus" ></p>
</div>   
<p>
<center><? echo $lang[sinfo];?> <a href="?page=tos"><? echo $lang[tos];?></a>.</center>
   </form>
         <div id="part2" style="display: none;">
<script language="javascript" src="xp_progress.js"></script>
<? echo $lang[progress];?>
<BR><BR>
<script type="text/javascript">
var bar1= createBar(300,15,'white',1,'black','blue',85,7,3,"");
</script>
<br>
<div align="center">
<form>
<input type="button" value="Cancel Upload" onclick="CancelUpload()">
</form>
</div>
</div>   <br /><? echo $lang[hosting];?>  <b><?php echo $total; ?></b> <? echo $lang[files];?> <b><?php echo $sizehosted; ?></b> MB <? echo $lang[total];?>
<p>   <? include("./bottomads.php"); ?>
</center></td></tr></table><p style="margin:3px;text-align:center">


When you click Upload Now, all of the files will start uploading.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Flashupload not automatic

Postby numix » Tue Jun 07, 2011 8:56 pm

Thanks man, you really helped me a lot to solve this Problem :)

But now i have got 5 More questions ^^
1. Is it possible to add a progressbar to the standartupload (not flashupload)?
2. I´d like to upload more than just one image at the standartupoad. Can you write a MOD to solve this problem and support the multiupload at standartupload?
3. How about a URL Upload to upload pictures from a remote server?
4. How about a Zip uloader ? So you upload the *.ZIP and the server unzips it and uploads the images in it automaticly?
5. How about Image-Resizing ? I think it´s a cool feature ...
numix
Standard Member
 
Posts: 12
Joined: Sun May 15, 2011 7:35 pm

Re: Flashupload not automatic

Postby SamEA » Wed Jun 08, 2011 8:57 pm

numix wrote:Thanks man, you really helped me a lot to solve this Problem :)

But now i have got 5 More questions ^^
1. Is it possible to add a progressbar to the standartupload (not flashupload)?
2. I´d like to upload more than just one image at the standartupoad. Can you write a MOD to solve this problem and support the multiupload at standartupload?
3. How about a URL Upload to upload pictures from a remote server?
4. How about a Zip uloader ? So you upload the *.ZIP and the server unzips it and uploads the images in it automaticly?
5. How about Image-Resizing ? I think it´s a cool feature ...


1. PHP is server-end, and so cannot produce a progress bar by itself. I believe AJAX, would be possible to implement, but there are several drawbacks to it, which I cannot remember what they were now.

2 & 5 are possible, but will require time to produce. Submit those points in the feature suggestion, and see if your feature request becomes high on demand.

4 I believe will require some PHP extensions, that some web hosters disable access to, or simply do not have.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Flashupload not automatic

Postby Maverick01 » Tue Sep 13, 2011 1:48 am

what i would like to see is a java applet uploader, dont know if this has been suggested yet?
Maverick01
Newbie Member
 
Posts: 3
Joined: Mon Sep 12, 2011 2:12 pm

Re: Flashupload not automatic

Postby SamEA » Tue Sep 13, 2011 9:26 pm

Submit in feature request, but I do not think Java applet uploader is used by many (in other words, not high on demand).
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: Flashupload not automatic

Postby Maverick01 » Wed Sep 14, 2011 1:38 am

I wish I could get any uploaded to work, every time I upload any file, I get error 500, it's vps hosting and I have access to php.ini and apache file, I have increased file/post size, memory limit, execution times etc, and still I can't upload anything over a hundred or so kb's. Any ideas?
Maverick01
Newbie Member
 
Posts: 3
Joined: Mon Sep 12, 2011 2:12 pm

Re: Flashupload not automatic

Postby Maverick01 » Wed Sep 14, 2011 1:39 am

And all perms are correctly set
Maverick01
Newbie Member
 
Posts: 3
Joined: Mon Sep 12, 2011 2:12 pm

Next

Return to Hacks and Modifications

Who is online

Users browsing this forum: No registered users and 3 guests

cron