Upload a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

Only the name gets inserted....
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

I see that there is 1 file that has been succesfully uploaded has the size isnt 0 but 3760 kb.
http://www.aoe3clan.com/index.php?name=36drew
But my recent tries to upload the files failed. The filename gets inserted in the table. Size is 0 and type is none......
The only file got loaded has like I said earlier 3760 KB and it's type is Application/Octect-stream or something like that....
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

I was wondering what are these files:

Code: Select all

 
include 'library/config.php';
include 'library/opendb.php';
and
include 'library/closedb.php';
 
Do I have to make these files? What is their use and cant I remove them?
mmj
Forum Contributor
Posts: 118
Joined: Fri Oct 31, 2008 4:00 pm

Re: Upload a file

Post by mmj »

Open them and see what they contain. :)
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

I took the code from this site lol:
http://www.php-mysql-tutorial.com/php-mysql-upload.php

So I kinda of dont know that.
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

Hey,

I finally managed to fix it. There was a mistype in the form.php

I was wondering how can I do something like this:

When you start typing the name of someone, I want a php code that runs to find every possible names for it.

Ex:
I want to type Patrick,
So I start by typing P and the code shows all the names starting with P, underneath the textbox, then I write A so its Pa and the code shows all anme starting iwth Pa


And 1 more question,
Why does this return no value?
:

Code: Select all

 
    <tr>
            <td>
                Map:
            </td>
            <td>
                <select name="map" size="1">
                <option value="Amazonia">Amazonia</option>
                <option value="Andes">Andes</option>
                <option value="Araucania">Araucania</option>
                <option value="Borneo">Borneo</option>
                <option value="Bayou">Bayou</option>
                <option value="California">California</option>
                <option value="Caribbean">Caribbean</option>
                <option value="Carolina">Carloina</option>
                <option value="Ceylon">Ceyolon</option>
                <option value="Deccan">Deccan</option>
                <option value="Indochina">Indochina</option>
                <option value="Himalayas">Himalayas</option>
                <option value="Honshu">Honshu</option>
                <option value="Great Lakes">Great Plains</option>
                <option value="Great Plains">Himalayas</option>
                <option value="Mongolia">Mongolia</option>
                <option value="New England">New England</option>
                <option value="NorthWest Territory">NorthWest Territory</option>
                <option value="Orinico">Orinico</option>
                <option value="Painted Desert">Painted Desert</option>
                <option value="Pamaps">Pampas</option>
                <option value="Patagonia">Patagonia</option>
                <option value="Rockies">Rockies</option>
                <option value="Saguenay">Saguenay</option>
                <option value="Siberia">Siberia</option>
                <option value="Silk Road">Silk Road</option>
                <option value="Sonora">Sonora</option>
                <option value="Texas">Texas</option>
                <option value="Unknown">Unknown</option>
                <option value="Yellow River">Yellow River</option>
                <option value="Yucatan">Yucatan</option>
                <option value="Yukon">Yukon</option>
                </select>
 
            </td>
 

Thanks for your help guys,
Ara
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

OK I got a code, but I get these 2 errors with that yellwo box with an exclamation poitns to the left bottom corner of the browser:
Line 16
'$' is unexpected
and
Line 25
Object expected

Code:

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax Auto Suggest</title>
 
<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
<script type="text/javascript">
    function lookup(inputString) {
        if(inputString.length == 0) {
            // Hide the suggestion box.
            $('#suggestions').hide();
        } else {
 
            $.post("rpc.php", {queryString: ""+inputString+""}, function(data){
                if(data.length >0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);
                }
            });
        }
    } // lookup
 
    function fill(thisValue) {
        $('#inputString').val(thisValue);
        setTimeout("$('#suggestions').hide();", 200);
    }
</script>
 
<style type="text/css">
    body {
        font-family: Helvetica;
        font-size: 11px;
        color: #000;
    }
 
    h3 {
        margin: 0px;
        padding: 0px;
    }
 
    .suggestionsBox {
        position: relative;
        left: 30px;
        margin: 10px 0px 0px 0px;
        width: 200px;
        background-color: #212427;
        -moz-border-radius: 7px;
        -webkit-border-radius: 7px;
        border: 2px solid #000;
        color: #fff;
    }
 
    .suggestionList {
        margin: 0px;
        padding: 0px;
    }
 
    .suggestionList li {
 
        margin: 0px 0px 3px 0px;
        padding: 3px;
        cursor: pointer;
    }
 
    .suggestionList li:hover {
        background-color: #659CD8;
    }
</style>
 
</head>
 
<body>
 
 
    <div>
        <form>
            <div>
                Type your county:
                <br />
                <input type="text" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
            </div>
 
            <div class="suggestionsBox" id="suggestions" style="display: none;">
                <img src="upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
                <div class="suggestionList" id="autoSuggestionsList">
                    &nbsp;
                </div>
            </div>
        </form>
    </div>
 
</body>
</html>
 
mmj
Forum Contributor
Posts: 118
Joined: Fri Oct 31, 2008 4:00 pm

Re: Upload a file

Post by mmj »

You should really be using Firefox.

And since you are working with JS install Firebug also.

Also you should be using the latest version of jQuery.

Now to your problem:

it seems like jquery isn't loading for some reason, make sure its their.
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

Thanks mmj, I got it working.
But for the other code I showed you?
I want to nsert teh value chosen by the user from a <option> <select> tags....
mmj
Forum Contributor
Posts: 118
Joined: Fri Oct 31, 2008 4:00 pm

Re: Upload a file

Post by mmj »

How are you retrieving the value?
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Upload a file

Post by Aravinthan »

Oh, I wrote mpa instead of map, for the $_Post. -.-
I got another problem:
http://www.aoe3clan.com/index.php?name=36Drew
The Game ID is ordered from DESC, but as you see 98 comes before 975 ..... how can I fix that?
Post Reply