Jump to content

Recommended Posts

I don't know where to post this...

I'm trying to get autoit to be able to uploade files larger than 20 mb, if I use my sites default upload script~

if (isset($_POST['_submit'])) {
   for ($i = 0; $i < $num_files; $i++) {
       if ($_FILES['_file']['name'][$i] == '')
       $File = strtr(stripslashes($_FILES['_file']['name'][$i]), ''" |/?!*#', '__________');
       $dotpos = strrpos($File, '.');
       $length = strlen($File);
       $ext = strtolower(substr($File, -($length - $dotpos - 1)));
       $noext  = substr($File, 0, -($length - $dotpos - 1));
        if (!in_array($ext, $flat_allowed)) {
           LogErrors("{$txt['extension']} <b>$ext</b> {$txt['not_allowed']}");
        switch($_FILES['_file']['error'][$i]) {
            case 0:
            case 1:
               continue 2;
            case 2:
               LogErrors("$txt[file_size] $txt[exceded_limit]");
               continue 2;
            case 3:
               continue 2;
            case 4:
               continue 2;
        if ($_FILES['_file']['size'][$i] > (_MAXSIZE * 1024)) {
           LogErrors($txt['file_size'].' ('.round($_FILES['_file']['size'][$i]/1024, 2)." $txt[KB]) {$txt['not_allowed']}");
        $fullname = _REALPATH.$File;
        if (!isset($content))
           $content = '';
        if (_OVERWRITE == false or !isset($_POST['_overwrite'])) {
           if (file_exists($fullname)) {
           if (isset($allowed['exec']) and in_array($ext, $allowed['exec'])) {
              if ($ext == 'php' and $highlight_php == true and file_exists(_REALPATH.$noext.'html')) {
              } elseif (file_exists(_REALPATH.$noext.'txt')) {
        if(@move_uploaded_file($_FILES['_file']['tmp_name'][$i], $fullname)) {
            if (isset($allowed['image']) and in_array($ext, $allowed['image']))
            elseif (isset($allowed['text']) and in_array($ext, $allowed['text']))
            elseif (isset($allowed['exec']) and in_array($ext, $allowed['exec']))
            elseif (isset($allowed['package']) and in_array($ext, $allowed['package']))
               $uploaded[] = $File;
            if ($change_mode == true)
               @chmod($fullname, $mode)or
        } else {
            LogErrors($txt['move_failiur'].'<br />'.$txt['try_again']);
            if (!file_exists(_REALPATH))
               echo '<span style="color:red; font-size: 12pt;"><b>'.$txt['doesnot_exist'].'</b></span><br />';
            elseif (!is_writable(_REALPATH))
               echo '<span style="color:red; font-size: 12pt;"><b>'.$txt['unwritable'].'</b></span><br />';
   if ($show_error_log == true and isset($errors) and count($errors) > 0)
   if ($show_uploaded_list == true and isset($uploaded) and count($uploaded) > 0)
   if (isset($content))
      echo $content;
   if ($show_upload_form == true)
   if ($notify_admin == true)
   if ($log_upload == true)
} else

I can uploade files up to 130+ mb from anywhere.

But using this code~

<html><body><form action="" method="post" enctype="multipart/form-data"><input type="hidden"  type="file" name="file" multiple="multiple" /><input type="hidden"  type="submit" /></form><?PHP if($_FILES){move_uploaded_file($_FILES['file']['tmp_name'],'C:/place/'.basename($_FILES['file']['name']));} ?></body></html>[/HTML]

I can't upload anything past 10+ mb except if I'm on the actual machine that hosts the server, what is going on?

I was making an app that archive music and uploads it to my server but as I discovered, it wont let me upload anything past 10mb from any of my friends places and I have to make a bunch of smaller archives in order to do it, which is not cool at all..

Edit: Got it too work..

Link to post
Share on other sites

In "php.ini" set:


To a bigger value. I assume you've got it set to a maximum of 10MB. I've had issues where I could upload files larger than the limit locally before.

Thanks for the info but I already have both the upload variables set to 150mb in php.ini, it's weird because the first larger script lets me upload large file both locally and remotely where the smaller script only lets me upload large files locally and not remotely.

memory_limit = 128M
post_max_size = 150M
file_uploads = On
upload_tmp_dir = C:/UniServer/tmp
upload_max_filesize = 150M
Link to post
Share on other sites

And how does AutoIt code look like? Are you sure the problem is/was not here?

I'm actually using the udf you co created, winhttp.au3, latest version unless someone updated it about a month ago.

#include "WinHttp.au3"
Func HTTPSend($File)
Local $hOpen, $hConnect, $sRead, $hOpen = _WinHttpOpen(), $hConnect = _WinHttpConnect($hOpen, "site.com"), _
$sRead = _WinHttpSimpleFormFill($hConnect, "test.php", "index:0", "name:file", $File)
Return $sRead
Link to post
Share on other sites

Can it be some firewall settings?

That may be what is happening, seeing as this only happens at different locations, that may very well be what is happening, or a slow connection, but in reality, I have no idea really, but if it was due to a firewall, it would be strange that the first php script lets me upload very large files from a browser universally and the second smaller php script seems to only work on PC's that are fast using autoit and when I'm on a laptop, it rarely works when the laptop is slow (i.e., an acer d250).

Link to post
Share on other sites
  • 4 weeks later...

Btw, I lol'd at your avatar.

Well, I changed my avatar, so people aren't going to know what you lol'd about ...

Anyway, I don't want to pollute the forum with my posts so I'll use this old thread...

I'm having trouble with PHP again, this time it involves javascript being injected from a php function into the main page, why does js not work when you write it to the page via php?

It looks something like this..

$Var .= '<head>' .  <<<EOF
<script type="text/javascript">
  ~Some js here & there~
Link to post
Share on other sites

The old avatar said: "The best thing about censorship is ████████" :)

Close, it was actually "The worst thing about censorship is ████████"

Anyway, I figured I'd just include the javascript code by obtaining it from an external source which works, but being able to change things in it with php would still be good..

Link to post
Share on other sites

Anyway, I figured I'd just include the javascript code by obtaining it from an external source which works, but being able to change things in it with php would still be good..

It works just fine. Shouldn't be any problems if you do it in most obvious way. Probably some mistake with quotes or escaping. Check the resulting HTML and if it matches your expectations. If it doesn't, then that's your problem. If it does, then your expectations need to be adjusted and you can find the correct way of putting Javascript in HTML. In second case, PHP is not the problem.
Link to post
Share on other sites

$Var = <<<EOF
<script type="text/javascript">
~Some js here & there~

Why would you concatenate a literal string with a heredoc?

A heredoc will only break if the EOF; is not on its own line with no indentation! You can copy whatever the fuck you want in there otherwise.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Exit
      I make plugins for WordPress and am dissatisfied with the built-in editor.
      I'm now looking for a way to format the PHP code like TIDY does in AU3-Editor.
      I've already tried some online tools but they are buggy or have too few formatting options.

      Buggy: http://www.phpformatter.com/
      Missing options: https://homepage-kosten.de/php_beautifier.php
      Here is the code to check if the beautifier is buggy:
      <?php /* Version: 2021.08.08#1 */ exit ( ' Version is: ' . chop ( substr ( file ( __FILE__ ) [ 2 ] , 9 , 13 ) ) ) ; /* Output from PHP Formatter: Format Error on line 5: parse error, unexpected '['([), expecting ')'! Output in Browser: Version is: 2021.08.08#1 */ ?> It would be great if you showed me a link to another beautifier that is not buggy and has options for compression.  
      e.g. do not put comments in a new line. 
      Or even better, a hint as to which PHP editor in WordPress meets these requirements.
      TIA Exit
    • By HansHenrik
      here's some PHP code to access AutoIt functions from php: 
      https://github.com/divinity76/autoit_php -
      as of writing, only 5 functions are added: MouseMove and MouseClick and _ScreenCapture_Capture and WinWaitActive and Send,

      it also has support for running in Cygwin (which is where i've developed it, but it *should*, in theory, run on normal php-cli for windows as well.), is there any community interest for this? 
      example usage
      <?php require_once("autoit.class.php"); $au = new AutoIt(); $au->MouseMove(10, 10, 5); $au->MouseClick("left"); echo "waiting up to 5 seconds for notepad window.."; if($au->WinWaitActive("[CLASS:Notepad]","",5)){ echo "found notepad!\n"; $au->Send("hello from autoit_php"); }else{ echo "timed out while waiting for notepad.\n"; } $imageBinary = $au->_ScreenCapture_Capture(); var_dump(strlen($imageBinary), imagecreatefromstring($imageBinary));  

      (i wanted to use some autoit functions from php-cli, and google wasn't of much help this time..)
    • By Jefrey
      I've made this HTTP lib to simplify HTTP requests, mainly when dealing about POST data or file uploads.
      Three functions are available:
      string _HTTP_Get ( string $sURL ) string _HTTP_Post ( string $sURL , string $sPostData ) string _HTTP_Upload ( string $sURL , string $sFilePath , string $sFileField , string $sPostData = '' , string $sFilename = Default) Additionaly, two helper functions are also available:
      URLEncode($sStr) URLDecode($sStr) Full documentation: https://github.com/jesobreira/HTTP.au3/blob/master/README.md
      Fork me on Github: https://github.com/jesobreira/HTTP.au3
      Download lib + docs: https://github.com/jesobreira/HTTP.au3/archive/master.zip
    • By MrTheDzam
      Hello guys!

      I changed my website's login page yesterday. In that file, i used header() function to redirect user from login page to error page.
      But now my script (use WinHttpObj library) can't work. But if i change the login page to old page (without redirect) then my script works

      How can i fix that? 
    • By James
      Hey all,
      I've been away for a while, working on one thing or another... Recently it's been StyleCI, The PHP Coding Style Service.
      StyleCI connects to your GitHub repositories and watches for commits or pull requests, with the ability of automatically fixing the code standards if it hasn't matched your settings.
      The likes of Laravel and Graze are using StyleCI now, among many other projects. Yesterday we hit a massive milestone, we analysed the 100,000 commit!
      I'd love to hear your feedback
  • Create New...