Upload images using the datamanager.
Hey,
In this tutorial I'll try to show you how you can upload images using the vb datamanaging class. First of all you have to make a special form to upload images. Like this: HTML Code:
<form method="post" enctype="multipart/form-data" action="portfolio.php"> <form method="post" enctype="multipart/form-data"> and <input type="file" name="upload"> then you can create a php file to process the upload. like this: PHP Code:
$vbulletin->input->clean_gpc("f","upload",TYPE_FILE); cleans the file $upload->path is the path to where the image has to be uploaded $vbulletin->GPC['upload'] is the file containing ($vbulletin->GPC['upload'][x]): -name: The name of the image -type: the mime type of the image, like: image/gif -tmp_name: the temporary name when the image is uploading -size: the filesize in bytes I hope this can help you regards, seba |
Asome thanks
|
Thanks for the tutorial, problem is that it doesn't check for files with the same name and just overwrites them.
Anyone know a way around this |
Quote:
|
I'd like to create something like this, but the problem I'm having with the directions is where does everything go? Where do I place the html and php code?
|
I'm wondering if the class has features to put the image right into the DB. I know there is debate about doing that, but I like it for small things like product images, etc.
Also, are functions included for displaying the image, either out of the DB or from disk? 'twould be nice. Thanks, Tim |
I know this is really old.. but to change the filename you can simply
$vbulletin->GPC['upload']['name'] = "blah"; This could cause unexpected bugs.. best thing to do is attempt to separate the files into directories.. maybe by user/thread/etc. etc. |
Quote:
Can someone help me with renaming the file? thank you so much |
I'm having problems using this... this is my code...
Code:
$file = $vbulletin->input->clean_gpc("f","upload",TYPE_FILE); Code:
function upload_game($game) Code:
There was an error encountered with your upload: |
shouldn't this thread also be in the vb area and not programming?
|
All times are GMT. The time now is 10:38 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|